Skip to content

Commit

Permalink
more manual clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Jan 8, 2024
1 parent e15f1c8 commit 18ab9c1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 48 deletions.
12 changes: 6 additions & 6 deletions crates/rattler_conda_types/benches/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ use rattler_conda_types::Version;

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("parse simple version", |b| {
b.iter(|| black_box("3.11.4").parse::<Version>())
b.iter(|| black_box("3.11.4").parse::<Version>());
});
c.bench_function("parse complex version", |b| {
b.iter(|| black_box("1!1.0b2.post345.dev456+3.2.20.rc3").parse::<Version>())
b.iter(|| black_box("1!1.0b2.post345.dev456+3.2.20.rc3").parse::<Version>());
});
c.bench_function("parse logical constraint", |b| {
b.iter(|| black_box(">=3.1").parse::<Version>())
b.iter(|| black_box(">=3.1").parse::<Version>());
});
c.bench_function("parse wildcard constraint", |b| {
b.iter(|| black_box("3.1.*").parse::<Version>())
b.iter(|| black_box("3.1.*").parse::<Version>());
});
c.bench_function("parse simple version spec", |b| {
b.iter(|| black_box(">=3.1").parse::<Version>())
b.iter(|| black_box(">=3.1").parse::<Version>());
});
c.bench_function("parse complex version spec", |b| {
b.iter(|| black_box("(>=2.1.0,<3.0)|(~=3.2.1,~3.2.2.1)|(==4.1)").parse::<Version>())
b.iter(|| black_box("(>=2.1.0,<3.0)|(~=3.2.1,~3.2.2.1)|(==4.1)").parse::<Version>());
});
}

Expand Down
32 changes: 16 additions & 16 deletions crates/rattler_lock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,22 +303,22 @@ mod test {
// Make sure that we have parsed some packages
assert!(!conda_lock.package.is_empty());
insta::with_settings!({sort_maps => true}, {
assert_yaml_snapshot!(
conda_lock
.packages_for_platform(Platform::Linux64)
.collect::<Vec<_>>()
);
assert_yaml_snapshot!(
conda_lock
.packages_for_platform(Platform::Osx64)
.collect::<Vec<_>>()
);
assert_yaml_snapshot!(
conda_lock
.packages_for_platform(Platform::OsxArm64)
.collect::<Vec<_>>()
);
})
assert_yaml_snapshot!(
conda_lock
.packages_for_platform(Platform::Linux64)
.collect::<Vec<_>>()
);
assert_yaml_snapshot!(
conda_lock
.packages_for_platform(Platform::Osx64)
.collect::<Vec<_>>()
);
assert_yaml_snapshot!(
conda_lock
.packages_for_platform(Platform::OsxArm64)
.collect::<Vec<_>>()
);
});
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/rattler_package_streaming/tests/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn compare_two_tar_archives<T: Read>(
.filter(|(k, _)| !k.starts_with(&info_licenses))
.collect::<HashMap<_, _>>();
}
_ => {}
FilterFiles::None => {}
}

assert_eq!(map1.len(), map2.len());
Expand Down
28 changes: 11 additions & 17 deletions crates/rattler_repodata_gateway/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand Down Expand Up @@ -1167,7 +1167,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.path().to_owned(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand All @@ -1180,7 +1180,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.path().to_owned(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand All @@ -1204,7 +1204,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand Down Expand Up @@ -1233,7 +1233,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand Down Expand Up @@ -1275,7 +1275,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand Down Expand Up @@ -1324,7 +1324,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand Down Expand Up @@ -1375,7 +1375,7 @@ mod test {
server.url(),
authenticated_client,
cache_dir.into_path(),
Default::default(),
FetchRepoDataOptions::default(),
None,
)
.await
Expand Down Expand Up @@ -1408,9 +1408,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
FetchRepoDataOptions {
..Default::default()
},
FetchRepoDataOptions::default(),
Some(Box::new(download_progress)),
)
.await
Expand All @@ -1433,9 +1431,7 @@ mod test {
.unwrap(),
AuthenticatedClient::default(),
cache_dir.into_path(),
FetchRepoDataOptions {
..Default::default()
},
FetchRepoDataOptions::default(),
None,
)
.await;
Expand All @@ -1457,9 +1453,7 @@ mod test {
server.url(),
AuthenticatedClient::default(),
cache_dir.into_path(),
FetchRepoDataOptions {
..Default::default()
},
FetchRepoDataOptions::default(),
None,
)
.await;
Expand Down
12 changes: 6 additions & 6 deletions crates/rattler_shell/src/activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,38 +750,38 @@ mod tests {
#[test]
#[cfg(windows)]
fn test_run_activation_powershell() {
test_run_activation(crate::shell::PowerShell::default().into())
test_run_activation(crate::shell::PowerShell::default().into());
}

#[test]
#[cfg(windows)]
fn test_run_activation_cmd() {
test_run_activation(crate::shell::CmdExe::default().into())
test_run_activation(crate::shell::CmdExe::default().into());
}

#[test]
#[cfg(unix)]
fn test_run_activation_bash() {
test_run_activation(crate::shell::Bash::default().into())
test_run_activation(crate::shell::Bash::default().into());
}

#[test]
#[cfg(target_os = "macos")]
fn test_run_activation_zsh() {
test_run_activation(crate::shell::Zsh::default().into())
test_run_activation(crate::shell::Zsh::default().into());
}

#[test]
#[cfg(unix)]
#[ignore]
fn test_run_activation_fish() {
test_run_activation(crate::shell::Fish::default().into())
test_run_activation(crate::shell::Fish::default().into());
}

#[test]
#[cfg(unix)]
#[ignore]
fn test_run_activation_xonsh() {
test_run_activation(crate::shell::Xonsh::default().into())
test_run_activation(crate::shell::Xonsh::default().into());
}
}
4 changes: 2 additions & 2 deletions crates/rattler_solve/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn bench_solve_environment(c: &mut Criterion, specs: Vec<&str>) {
specs: specs.clone(),
}))
.unwrap()
})
});
});

#[cfg(feature = "resolvo")]
Expand All @@ -81,7 +81,7 @@ fn bench_solve_environment(c: &mut Criterion, specs: Vec<&str>) {
specs: specs.clone(),
}))
.unwrap()
})
});
});

group.finish();
Expand Down

0 comments on commit 18ab9c1

Please sign in to comment.