diff --git a/src/cmd/lint.rs b/src/cmd/lint.rs index c2a2287..7181a5a 100644 --- a/src/cmd/lint.rs +++ b/src/cmd/lint.rs @@ -283,7 +283,7 @@ impl NeverEnablesCmd { let Some(enabled) = lhs.features.get(&self.precondition) else { continue }; // TODO do the same in other command. - if enabled.contains(&format!("{}", self.stays_disabled)) { + if enabled.contains(&self.stays_disabled.to_string()) { offenders.entry(lhs.id.to_string()).or_default().insert(RenamedPackage::new( (*lhs).clone(), None, diff --git a/src/dag.rs b/src/dag.rs index 11a194a..0f16ca7 100644 --- a/src/dag.rs +++ b/src/dag.rs @@ -30,7 +30,7 @@ where fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { for (from, tos) in self.edges.iter() { for to in tos { - write!(f, "{} -> {}\n", from, to)?; + writeln!(f, "{} -> {}", from, to)?; } } Ok(()) diff --git a/src/mock/mod.rs b/src/mock/mod.rs index 34b15e7..7db405b 100644 --- a/src/mock/mod.rs +++ b/src/mock/mod.rs @@ -9,7 +9,6 @@ pub mod git; pub use git::*; use std::{ - any, collections::HashMap, fs, io::Write, @@ -60,7 +59,7 @@ impl CaseFile { } pub fn to_file(&self, path: &Path) -> Result<(), anyhow::Error> { - let mut fd = fs::File::create(&path).unwrap(); + let mut fd = fs::File::create(path).unwrap(); match self { CaseFile::Ui(ui) => serde_yaml::to_writer(&mut fd, &ui), @@ -144,6 +143,7 @@ pub struct CrateConfig { name: ModuleName, #[serde(skip_serializing_if = "Option::is_none")] deps: Option>, + #[allow(clippy::type_complexity)] #[serde(skip_serializing_if = "Option::is_none")] features: Option>>>, } @@ -159,6 +159,12 @@ pub struct Context { pub root: tempfile::TempDir, } +impl Default for Context { + fn default() -> Self { + Self::new() + } +} + impl Context { pub fn new() -> Self { Self { root: tempfile::tempdir().expect("Must create a temporary directory") } diff --git a/tests/tests.rs b/tests/tests.rs index 3f2533e..b2216db 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: Oliver Tale-Yazdi use assert_cmd::{assert::OutputAssertExt, Command}; -use std::{collections::HashMap, fs}; +use std::{collections::HashMap}; use zepter::mock::*;