diff options
-rw-r--r-- | autocrypt/src/lib.rs | 4 | ||||
-rw-r--r-- | openpgp/src/armor.rs | 6 | ||||
-rw-r--r-- | openpgp/src/armor/base64_utils.rs | 2 | ||||
-rw-r--r-- | openpgp/src/fingerprint.rs | 12 | ||||
-rw-r--r-- | openpgp/src/fmt.rs | 2 | ||||
-rw-r--r-- | openpgp/src/keyid.rs | 10 | ||||
-rw-r--r-- | openpgp/src/packet/header/ctb.rs | 2 | ||||
-rw-r--r-- | openpgp/src/packet/userid.rs | 4 |
8 files changed, 21 insertions, 21 deletions
diff --git a/autocrypt/src/lib.rs b/autocrypt/src/lib.rs index b6820289..257469f3 100644 --- a/autocrypt/src/lib.rs +++ b/autocrypt/src/lib.rs @@ -468,10 +468,10 @@ impl AutocryptSetupMessage { let mut p : Vec<u8> = Vec::new(); for i in 0..36 { if i > 0 && i % 4 == 0 { - p.push('-' as u8); + p.push(b'-'); } - p.push(('0' as u8) + ((p_as_u128 as u8) % 10)); + p.push(b'0' + ((p_as_u128 as u8) % 10)); p_as_u128 = p_as_u128 / 10; } diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs index 13d5afa2..3ac9886a 100644 --- a/openpgp/src/armor.rs +++ b/openpgp/src/armor.rs @@ -1005,7 +1005,7 @@ impl<'a> Reader<'a> { // allowed. But, instead of failing, we try to recover, by // stopping at the first non-whitespace character. let n = { - let line = self.source.read_to('\n' as u8)?; + let line = self.source.read_to(b'\n')?; line.iter().position(|&c| { !c.is_ascii_whitespace() }).unwrap_or(line.len()) @@ -1048,7 +1048,7 @@ impl<'a> Reader<'a> { self.source.consume(n); // Buffer the next line. - let line = self.source.read_to('\n' as u8)?; + let line = self.source.read_to(b'\n')?; n = line.len(); lines += 1; @@ -1266,7 +1266,7 @@ impl<'a> Reader<'a> { }; if data.len() == 5 - && data[0] == '=' as u8 + && data[0] == b'=' && data[1..5].iter().all(is_base64_char) { /* Found. */ diff --git a/openpgp/src/armor/base64_utils.rs b/openpgp/src/armor/base64_utils.rs index e67ea6ee..9e7fe500 100644 --- a/openpgp/src/armor/base64_utils.rs +++ b/openpgp/src/armor/base64_utils.rs @@ -183,7 +183,7 @@ pub fn is_armored_pgp_blob(bytes: &[u8]) -> bool { /// Checks whether the given byte is in the base64 character set. pub fn is_base64_char(b: &u8) -> bool { - b.is_ascii_alphanumeric() || *b == '+' as u8 || *b == '/' as u8 + b.is_ascii_alphanumeric() || *b == b'+' || *b == b'/' } /// Returns the number of bytes of base64 data are needed to encode diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs index cccae03e..eba7cfa5 100644 --- a/openpgp/src/fingerprint.rs +++ b/openpgp/src/fingerprint.rs @@ -256,26 +256,26 @@ impl Fingerprint { for (i, b) in raw.iter().enumerate() { if pretty && i > 0 && i % 2 == 0 { - output.push(' ' as u8); + output.push(b' '); } if pretty && i > 0 && i % 10 == 0 { - output.push(' ' as u8); + output.push(b' '); } let top = b >> 4; let bottom = b & 0xFu8; if top < 10u8 { - output.push('0' as u8 + top) + output.push(b'0' + top) } else { - output.push('A' as u8 + (top - 10u8)) + output.push(b'A' + (top - 10u8)) } if bottom < 10u8 { - output.push('0' as u8 + bottom) + output.push(b'0' + bottom) } else { - output.push('A' as u8 + (bottom - 10u8)) + output.push(b'A' + (bottom - 10u8)) } } diff --git a/openpgp/src/fmt.rs b/openpgp/src/fmt.rs index 5c62d1bd..4e04e74f 100644 --- a/openpgp/src/fmt.rs +++ b/openpgp/src/fmt.rs @@ -216,7 +216,7 @@ pub(crate) fn to_hex(s: &[u8], pretty: bool) -> String { /// This function skips whitespace if `pretty` is set. pub(crate) fn from_hex(hex: &str, pretty: bool) -> Result<Vec<u8>> { const BAD: u8 = 255u8; - const X: u8 = 'x' as u8; + const X: u8 = b'x'; let mut nibbles = hex.chars().filter_map(|x| { match x { diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs index fa4ee314..fbf7d875 100644 --- a/openpgp/src/keyid.rs +++ b/openpgp/src/keyid.rs @@ -374,22 +374,22 @@ impl KeyID { for (i, b) in raw.iter().enumerate() { if pretty && i > 0 && i % 2 == 0 { - output.push(' ' as u8); + output.push(b' '); } let top = b >> 4; let bottom = b & 0xFu8; if top < 10u8 { - output.push('0' as u8 + top) + output.push(b'0' + top) } else { - output.push('A' as u8 + (top - 10u8)) + output.push(b'A' + (top - 10u8)) } if bottom < 10u8 { - output.push('0' as u8 + bottom) + output.push(b'0' + bottom) } else { - output.push('A' as u8 + (bottom - 10u8)) + output.push(b'A' + (bottom - 10u8)) } } diff --git a/openpgp/src/packet/header/ctb.rs b/openpgp/src/packet/header/ctb.rs index 2e32b41d..9b2c978f 100644 --- a/openpgp/src/packet/header/ctb.rs +++ b/openpgp/src/packet/header/ctb.rs @@ -238,7 +238,7 @@ impl TryFrom<u8> for CTB { Error::MalformedPacket( format!("Malformed CTB: MSB of ptag ({:#010b}) not set{}.", ptag, - if ptag == '-' as u8 { + if ptag == b'-' { " (ptag is a dash, perhaps this is an \ ASCII-armor encoded message)" } else { diff --git a/openpgp/src/packet/userid.rs b/openpgp/src/packet/userid.rs index f9f3c1a4..62c0d325 100644 --- a/openpgp/src/packet/userid.rs +++ b/openpgp/src/packet/userid.rs @@ -1377,11 +1377,11 @@ mod tests { // Long strings. assert_eq!( - UserID::from(String::from_utf8(vec!['a' as u8; 90]).unwrap()) + UserID::from(String::from_utf8(vec![b'a'; 90]).unwrap()) .hash_algo_security(), HashAlgoSecurity::SecondPreImageResistance); assert_eq!( - UserID::from(String::from_utf8(vec!['a' as u8; 100]).unwrap()) + UserID::from(String::from_utf8(vec![b'a'; 100]).unwrap()) .hash_algo_security(), HashAlgoSecurity::CollisionResistance); } |