diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-22 14:18:15 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-29 11:53:55 +0100 |
commit | 4ecbe9e0348b2d56e2d5431aac54c342a08ca1a6 (patch) | |
tree | 0cbd589baf1bf39ce1ed1d87c2af39c2b05566a5 /openpgp | |
parent | f63f3181c87877a5a5b261d0f1e206615de613f6 (diff) |
Fix Acronym spelling.
- In CamelCase, acronyms count as one word. Apply this rule where
API and lalrpop are not impacted.
- Found by clippy::upper_case_acronyms.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/armor.rs | 11 | ||||
-rw-r--r-- | openpgp/src/armor/crc.rs | 10 | ||||
-rw-r--r-- | openpgp/src/parse.rs | 2 | ||||
-rw-r--r-- | openpgp/src/regex/lexer.rs | 1 | ||||
-rw-r--r-- | openpgp/src/serialize.rs | 1 | ||||
-rw-r--r-- | openpgp/src/serialize/cert_armored.rs | 1 | ||||
-rw-r--r-- | openpgp/src/serialize/stream/writer/writer_deflate.rs | 2 |
7 files changed, 18 insertions, 10 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs index a1eb3c7c..676bc306 100644 --- a/openpgp/src/armor.rs +++ b/openpgp/src/armor.rs @@ -51,7 +51,7 @@ use crate::{vec_resize, vec_truncate}; mod base64_utils; use base64_utils::*; mod crc; -use crc::CRC; +use crc::Crc; /// The encoded output stream must be represented in lines of no more /// than 76 characters each (see (see [RFC 4880, section @@ -236,7 +236,7 @@ pub struct Writer<W: Write> { kind: Kind, stash: Vec<u8>, column: usize, - crc: CRC, + crc: Crc, header: Vec<u8>, dirty: bool, scratch: Vec<u8>, @@ -309,7 +309,7 @@ impl<W: Write> Writer<W> { kind, stash: Vec::<u8>::with_capacity(2), column: 0, - crc: CRC::new(), + crc: Crc::new(), header: Vec::with_capacity(128), dirty: false, scratch: vec![0; 4096], @@ -558,7 +558,7 @@ pub struct Reader<'a> { kind: Option<Kind>, mode: ReaderMode, decode_buffer: Vec<u8>, - crc: CRC, + crc: Crc, expect_crc: Option<u32>, initialized: bool, headers: Vec<(String, String)>, @@ -593,6 +593,7 @@ impl Default for ReaderMode { /// State for transforming a message using the Cleartext Signature /// Framework into an inline signed message. #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[allow(clippy::upper_case_acronyms)] enum CSFTransformer { OPS, Literal, @@ -747,7 +748,7 @@ impl<'a> Reader<'a> { kind: None, mode, decode_buffer: Vec::<u8>::with_capacity(1024), - crc: CRC::new(), + crc: Crc::new(), expect_crc: None, headers: Vec::new(), initialized: false, diff --git a/openpgp/src/armor/crc.rs b/openpgp/src/armor/crc.rs index 45819692..bfa62d8c 100644 --- a/openpgp/src/armor/crc.rs +++ b/openpgp/src/armor/crc.rs @@ -6,16 +6,16 @@ const CRC24_INIT: u32 = 0xB704CE; const CRC24_POLY: u32 = 0x864CFB; #[derive(Debug)] -pub struct CRC { +pub struct Crc { n: u32, } /// Computes the CRC-24, (see [RFC 4880, section 6.1]). /// /// [RFC 4880, section 6.1]: https://tools.ietf.org/html/rfc4880#section-6.1 -impl CRC { +impl Crc { pub fn new() -> Self { - CRC { n: CRC24_INIT } + Self { n: CRC24_INIT } } /// Updates the CRC sum using the given data. @@ -84,7 +84,7 @@ mod tests { ]; for len in 0..b.len() + 1 { - assert_eq!(CRC::new().update(&b[..len]).finalize(), crcs[len]); + assert_eq!(Crc::new().update(&b[..len]).finalize(), crcs[len]); } } @@ -105,7 +105,7 @@ mod tests { quickcheck! { fn compare(b: Vec<u8>) -> bool { - let mut c = CRC::new(); + let mut c = Crc::new(); c.update(&b); assert_eq!(c.finalize(), iterative(&b)); true diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index fe2f3db5..4bd93fff 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -605,6 +605,7 @@ impl<'a, T: 'a + BufferedReader<Cookie>> PacketHeaderParser<T> { /// What the hash in the Cookie is for. #[derive(Copy, Clone, PartialEq, Debug)] +#[allow(clippy::upper_case_acronyms)] pub(crate) enum HashesFor { Nothing, MDC, @@ -3339,6 +3340,7 @@ impl<'a> std::fmt::Debug for PacketParser<'a> { } /// The return value of PacketParser::parse. +#[allow(clippy::upper_case_acronyms)] enum ParserResult<'a> { Success(PacketParser<'a>), EOF((Box<dyn BufferedReader<Cookie> + 'a>, PacketParserState, Vec<usize>)), diff --git a/openpgp/src/regex/lexer.rs b/openpgp/src/regex/lexer.rs index 3d6c1e45..30a0df8b 100644 --- a/openpgp/src/regex/lexer.rs +++ b/openpgp/src/regex/lexer.rs @@ -23,6 +23,7 @@ pub(crate) type LexerItem<Token, Loc, LexicalError> /// The components of an OpenPGP Message. #[derive(Debug, Clone, PartialEq)] +#[allow(clippy::upper_case_acronyms)] pub enum Token { PIPE, diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs index 04f36403..3f124004 100644 --- a/openpgp/src/serialize.rs +++ b/openpgp/src/serialize.rs @@ -2689,6 +2689,7 @@ impl MarshalInto for Packet { /// [`openpgp::Packet`]: super::Packet /// [`packet::Signature`]: crate::packet::Signature #[allow(dead_code)] +#[allow(clippy::upper_case_acronyms)] enum PacketRef<'a> { /// Unknown packet. Unknown(&'a packet::Unknown), diff --git a/openpgp/src/serialize/cert_armored.rs b/openpgp/src/serialize/cert_armored.rs index 68f7d332..529a4379 100644 --- a/openpgp/src/serialize/cert_armored.rs +++ b/openpgp/src/serialize/cert_armored.rs @@ -121,6 +121,7 @@ impl<'a> TSK<'a> { } /// A `Cert` or `TSK` to be armored and serialized. +#[allow(clippy::upper_case_acronyms)] enum Encoder<'a> { Cert(&'a Cert), TSK(TSK<'a>), diff --git a/openpgp/src/serialize/stream/writer/writer_deflate.rs b/openpgp/src/serialize/stream/writer/writer_deflate.rs index 1be85d15..5f2cd3e5 100644 --- a/openpgp/src/serialize/stream/writer/writer_deflate.rs +++ b/openpgp/src/serialize/stream/writer/writer_deflate.rs @@ -7,6 +7,7 @@ use crate::types::CompressionLevel; use super::{Generic, Message, BoxStack, Stackable, Cookie}; /// ZIP compressing writer. +#[allow(clippy::upper_case_acronyms)] pub struct ZIP<'a, C: 'a> { inner: Generic<DeflateEncoder<BoxStack<'a, C>>, C>, } @@ -77,6 +78,7 @@ impl<'a, C: 'a> Stackable<'a, C> for ZIP<'a, C> { } /// ZLIB compressing writer. +#[allow(clippy::upper_case_acronyms)] pub struct ZLIB<'a, C: 'a> { inner: Generic<ZlibEncoder<BoxStack<'a, C>>, C>, } |