diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-07 21:38:09 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-09 13:13:59 +0200 |
commit | 792dfa2105e0a75a27ebffdc1cf0ab8873deaac1 (patch) | |
tree | f4770d8297c001ef624c7e716a6c45e8c5ea6b63 | |
parent | 8b49cc933cbeda3e34420679288c4985abdc6059 (diff) |
Lint: Use char for single characters.
- https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
- https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
-rw-r--r-- | ffi-macros/src/lib.rs | 6 | ||||
-rw-r--r-- | openpgp/src/armor.rs | 2 | ||||
-rw-r--r-- | openpgp/src/fingerprint.rs | 2 | ||||
-rw-r--r-- | openpgp/src/packet/userid.rs | 8 | ||||
-rw-r--r-- | sq/build.rs | 6 | ||||
-rw-r--r-- | sqv/build.rs | 6 |
6 files changed, 15 insertions, 15 deletions
diff --git a/ffi-macros/src/lib.rs b/ffi-macros/src/lib.rs index 27c6a183..29a49d85 100644 --- a/ffi-macros/src/lib.rs +++ b/ffi-macros/src/lib.rs @@ -67,7 +67,7 @@ pub fn cdecl(_attr: TokenStream, item: TokenStream) -> TokenStream { let mut cdecl = TokenStream2::new(); doc(" # C Declaration", &mut cdecl); doc(" ```c", &mut cdecl); - for line in rust2c::rust2c(&fun).split("\n") { + for line in rust2c::rust2c(&fun).split('\n') { doc(&format!(" {}", line), &mut cdecl); } doc(" ```", &mut cdecl); @@ -212,11 +212,11 @@ pub fn ffi_wrapper_type(args: TokenStream, input: TokenStream) -> TokenStream { "name" => name = Some(value), "prefix" => prefix = Some(value), "derive" => { - for ident in value.split(",").map(|d| d.trim() + for ident in value.split(',').map(|d| d.trim() .to_string()) { let (ident, arg) = if let Some(i) = ident.find('(') { - if ! ident.ends_with(")") { + if ! ident.ends_with(')') { return syn::Error::new( mnv.path.span(), format!("missing closing \ diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs index 1fa3c671..7f35a804 100644 --- a/openpgp/src/armor.rs +++ b/openpgp/src/armor.rs @@ -1074,7 +1074,7 @@ impl<'a> Reader<'a> { let line = if line.ends_with(&"\r\n"[..]) { // \r\n. &line[..line.len() - 2] - } else if line.ends_with("\n") { + } else if line.ends_with('\n') { // \n. &line[..line.len() - 1] } else { diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs index eba7cfa5..4fa92dc7 100644 --- a/openpgp/src/fingerprint.rs +++ b/openpgp/src/fingerprint.rs @@ -334,7 +334,7 @@ impl Fingerprint { }; if !ret.is_empty() { - ret.push_str(" "); + ret.push(' '); } ret.push_str(word); } diff --git a/openpgp/src/packet/userid.rs b/openpgp/src/packet/userid.rs index e2f81a6a..49be2629 100644 --- a/openpgp/src/packet/userid.rs +++ b/openpgp/src/packet/userid.rs @@ -628,11 +628,11 @@ impl UserID { } if !value.is_empty() { - value.push_str(" "); + value.push(' '); } - value.push_str("("); + value.push('('); value.push_str(comment); - value.push_str(")"); + value.push(')'); } if check_address { @@ -661,7 +661,7 @@ impl UserID { } value.push_str(address); if something { - value.push_str(">"); + value.push('>'); } if check_address { diff --git a/sq/build.rs b/sq/build.rs index 49d55740..07de15e0 100644 --- a/sq/build.rs +++ b/sq/build.rs @@ -68,7 +68,7 @@ fn dump_help(sink: &mut dyn io::Write, .unwrap_err().to_string(); writeln!(sink, "//! ```text")?; - for line in help.trim_end().split("\n").skip(1) { + for line in help.trim_end().split('\n').skip(1) { if line.is_empty() { writeln!(sink, "//!")?; } else { @@ -79,7 +79,7 @@ fn dump_help(sink: &mut dyn io::Write, // Recurse. let mut found_subcommands = false; - for subcmd in help.split("\n").filter_map(move |line| { + for subcmd in help.split('\n').filter_map(move |line| { if line == "SUBCOMMANDS:" { found_subcommands = true; None @@ -87,7 +87,7 @@ fn dump_help(sink: &mut dyn io::Write, if line.chars().nth(4).map(|c| ! c.is_ascii_whitespace()) .unwrap_or(false) { - line.trim_start().split(" ").next() + line.trim_start().split(' ').next() } else { None } diff --git a/sqv/build.rs b/sqv/build.rs index 5bcc35d5..921e71ff 100644 --- a/sqv/build.rs +++ b/sqv/build.rs @@ -65,7 +65,7 @@ fn dump_help(sink: &mut dyn io::Write, .unwrap_err().to_string(); writeln!(sink, "//! ```text")?; - for line in help.trim_end().split("\n").skip(1) { + for line in help.trim_end().split('\n').skip(1) { if line.is_empty() { writeln!(sink, "//!")?; } else { @@ -76,7 +76,7 @@ fn dump_help(sink: &mut dyn io::Write, // Recurse. let mut found_subcommands = false; - for subcmd in help.split("\n").filter_map(move |line| { + for subcmd in help.split('\n').filter_map(move |line| { if line == "SUBCOMMANDS:" { found_subcommands = true; None @@ -84,7 +84,7 @@ fn dump_help(sink: &mut dyn io::Write, if line.chars().nth(4).map(|c| ! c.is_ascii_whitespace()) .unwrap_or(false) { - line.trim_start().split(" ").next() + line.trim_start().split(' ').next() } else { None } |