Run clippy --fix for updated lint requirements (#43)

This commit is contained in:
gusto 2023-01-27 11:06:21 +02:00 committed by GitHub
parent 67e5aef69a
commit 4c71e135ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View File

@ -139,7 +139,7 @@ fn main() -> std::result::Result<(), Box<dyn Error>> {
} }
Err(e) => { Err(e) => {
let mut out = std::io::stderr(); let mut out = std::io::stderr();
write!(out, "{:?}", e).unwrap(); write!(out, "{e:?}").unwrap();
} }
} }
} }
@ -164,7 +164,7 @@ fn main() -> std::result::Result<(), Box<dyn Error>> {
app.node_handle.stop()?; app.node_handle.stop()?;
if let Err(err) = res { if let Err(err) = res {
println!("{:?}", err) println!("{err:?}")
} }
Ok(()) Ok(())
} }
@ -204,7 +204,7 @@ fn run_app<B: Backend>(
.relay_publish_message(&waku_message, None, None) .relay_publish_message(&waku_message, None, None)
{ {
let mut out = std::io::stderr(); let mut out = std::io::stderr();
write!(out, "{:?}", e).unwrap(); write!(out, "{e:?}").unwrap();
} }
} }
KeyCode::Char(c) => { KeyCode::Char(c) => {

View File

@ -31,7 +31,7 @@ pub enum ProtocolId {
impl ProtocolId { impl ProtocolId {
pub fn as_string_with_version(&self, version: &str) -> String { 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)] #[allow(unreachable_patterns)]
_ => unreachable!(), _ => unreachable!(),
}; };
write!(f, "{}", tag) write!(f, "{tag}")
} }
} }
@ -319,7 +319,7 @@ impl FromStr for Encoding {
"proto" => Ok(Self::Proto), "proto" => Ok(Self::Proto),
"rlp" => Ok(Self::Rlp), "rlp" => Ok(Self::Rlp),
"rfc26" => Ok(Self::Rfc26), "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 { } else {
Err( Err(
format!( format!(
"Wrong pub-sub topic format. Should be `/{{application-name}}/{{version-of-the-application}}/{{content-topic-name}}/{{encoding}}`. Got: {}", "Wrong pub-sub topic format. Should be `/{{application-name}}/{{version-of-the-application}}/{{content-topic-name}}/{{encoding}}`. Got: {s}"
s
) )
) )
} }
@ -443,8 +442,7 @@ impl FromStr for WakuPubSubTopic {
} else { } else {
Err( Err(
format!( format!(
"Wrong pub-sub topic format. Should be `/waku/2/{{topic-name}}/{{encoding}}`. Got: {}", "Wrong pub-sub topic format. Should be `/waku/2/{{topic-name}}/{{encoding}}`. Got: {s}"
s
) )
) )
} }

View File

@ -84,7 +84,7 @@ impl FromStr for WakuLogLevel {
"fatal" => Ok(Self::Fatal), "fatal" => Ok(Self::Fatal),
_ => Err(std::io::Error::new( _ => Err(std::io::Error::new(
std::io::ErrorKind::InvalidData, 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\""),
)), )),
} }
} }

View File

@ -9,7 +9,7 @@ fn get_go_bin() -> String {
Command::new("/usr/bin/which") Command::new("/usr/bin/which")
.arg("go") .arg("go")
.output() .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") .expect("`which` command not found")
.stdout, .stdout,
) )
@ -50,7 +50,7 @@ fn build_go_waku_lib(go_bin: &str, project_dir: &Path) {
} }
cmd.status() 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(); .unwrap();
set_current_dir(project_dir).expect("Going back to project dir"); set_current_dir(project_dir).expect("Going back to project dir");