Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Jul 29, 2023
1 parent 46632ae commit 34b4113
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cmd/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
10 changes: 8 additions & 2 deletions src/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub mod git;
pub use git::*;

use std::{
any,
collections::HashMap,
fs,
io::Write,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -144,6 +143,7 @@ pub struct CrateConfig {
name: ModuleName,
#[serde(skip_serializing_if = "Option::is_none")]
deps: Option<Vec<CrateDependency>>,
#[allow(clippy::type_complexity)]
#[serde(skip_serializing_if = "Option::is_none")]
features: Option<HashMap<String, Option<Vec<(String, String)>>>>,
}
Expand All @@ -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") }
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Oliver Tale-Yazdi <oliver@tasty.limo>

use assert_cmd::{assert::OutputAssertExt, Command};
use std::{collections::HashMap, fs};
use std::{collections::HashMap};

use zepter::mock::*;

Expand Down

0 comments on commit 34b4113

Please sign in to comment.