From 4c71e135ab0d3e90454de101496f32d490bc583c Mon Sep 17 00:00:00 2001 From: gusto Date: Fri, 27 Jan 2023 11:06:21 +0200 Subject: [PATCH] Run clippy --fix for updated lint requirements (#43) --- examples/toy-chat/src/main.rs | 6 +++--- waku-bindings/src/general/mod.rs | 12 +++++------- waku-bindings/src/node/config.rs | 2 +- waku-sys/build.rs | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/toy-chat/src/main.rs b/examples/toy-chat/src/main.rs index e72c7c6..bffc5d9 100644 --- a/examples/toy-chat/src/main.rs +++ b/examples/toy-chat/src/main.rs @@ -139,7 +139,7 @@ fn main() -> std::result::Result<(), Box> { } Err(e) => { let mut out = std::io::stderr(); - write!(out, "{:?}", e).unwrap(); + write!(out, "{e:?}").unwrap(); } } } @@ -164,7 +164,7 @@ fn main() -> std::result::Result<(), Box> { app.node_handle.stop()?; if let Err(err) = res { - println!("{:?}", err) + println!("{err:?}") } Ok(()) } @@ -204,7 +204,7 @@ fn run_app( .relay_publish_message(&waku_message, None, None) { let mut out = std::io::stderr(); - write!(out, "{:?}", e).unwrap(); + write!(out, "{e:?}").unwrap(); } } KeyCode::Char(c) => { diff --git a/waku-bindings/src/general/mod.rs b/waku-bindings/src/general/mod.rs index cd5c012..9d0f16b 100644 --- a/waku-bindings/src/general/mod.rs +++ b/waku-bindings/src/general/mod.rs @@ -31,7 +31,7 @@ pub enum ProtocolId { impl ProtocolId { pub fn as_string_with_version(&self, version: &str) -> String { - format!("{}/{}", self, version) + format!("{self}/{version}") } } @@ -45,7 +45,7 @@ impl Display for ProtocolId { #[allow(unreachable_patterns)] _ => unreachable!(), }; - write!(f, "{}", tag) + write!(f, "{tag}") } } @@ -319,7 +319,7 @@ impl FromStr for Encoding { "proto" => Ok(Self::Proto), "rlp" => Ok(Self::Rlp), "rfc26" => Ok(Self::Rfc26), - encoding => Err(format!("Unrecognized encoding: {}", encoding)), + encoding => Err(format!("Unrecognized encoding: {encoding}")), } } } @@ -369,8 +369,7 @@ impl FromStr for WakuContentTopic { } else { Err( format!( - "Wrong pub-sub topic format. Should be `/{{application-name}}/{{version-of-the-application}}/{{content-topic-name}}/{{encoding}}`. Got: {}", - s + "Wrong pub-sub topic format. Should be `/{{application-name}}/{{version-of-the-application}}/{{content-topic-name}}/{{encoding}}`. Got: {s}" ) ) } @@ -443,8 +442,7 @@ impl FromStr for WakuPubSubTopic { } else { Err( format!( - "Wrong pub-sub topic format. Should be `/waku/2/{{topic-name}}/{{encoding}}`. Got: {}", - s + "Wrong pub-sub topic format. Should be `/waku/2/{{topic-name}}/{{encoding}}`. Got: {s}" ) ) } diff --git a/waku-bindings/src/node/config.rs b/waku-bindings/src/node/config.rs index ecbf5a6..71d68ee 100644 --- a/waku-bindings/src/node/config.rs +++ b/waku-bindings/src/node/config.rs @@ -84,7 +84,7 @@ impl FromStr for WakuLogLevel { "fatal" => Ok(Self::Fatal), _ => Err(std::io::Error::new( std::io::ErrorKind::InvalidData, - format!("Unrecognized waku log level: {}. Allowed values \"DEBUG\", \"INFO\", \"WARN\", \"ERROR\", \"DPANIC\", \"PANIC\", \"FATAL\"", s), + format!("Unrecognized waku log level: {s}. Allowed values \"DEBUG\", \"INFO\", \"WARN\", \"ERROR\", \"DPANIC\", \"PANIC\", \"FATAL\""), )), } } diff --git a/waku-sys/build.rs b/waku-sys/build.rs index 4193d36..5f9a417 100644 --- a/waku-sys/build.rs +++ b/waku-sys/build.rs @@ -9,7 +9,7 @@ fn get_go_bin() -> String { Command::new("/usr/bin/which") .arg("go") .output() - .map_err(|e| println!("cargo:warning=Couldn't find `which` command: {}", e)) + .map_err(|e| println!("cargo:warning=Couldn't find `which` command: {e}")) .expect("`which` command not found") .stdout, ) @@ -50,7 +50,7 @@ fn build_go_waku_lib(go_bin: &str, project_dir: &Path) { } cmd.status() - .map_err(|e| println!("cargo:warning=go build failed due to: {}", e)) + .map_err(|e| println!("cargo:warning=go build failed due to: {e}")) .unwrap(); set_current_dir(project_dir).expect("Going back to project dir");