cargo clippy --all-targets --fix

Suggested in #169, I just ran it myself.

Co-authored-by: i1i1 <vanyarybin1@live.ru>
This commit is contained in:
Zhaofeng Li 2023-10-18 15:41:54 -06:00
parent 82c8c7044a
commit 8d92dadb32
10 changed files with 17 additions and 21 deletions

View file

@ -42,7 +42,7 @@ pub async fn run(_global_args: &ArgMatches, local_args: &ArgMatches) -> Result<(
if nix_version.at_least(2, 4) {
// `nix repl` is expected to be marked as experimental:
// <https://github.com/NixOS/nix/issues/5604>
repl_cmd.args(&["--experimental-features", "nix-command flakes"]);
repl_cmd.args(["--experimental-features", "nix-command flakes"]);
}
if nix_version.at_least(2, 10) {

View file

@ -80,12 +80,12 @@ impl DrvSetEvaluator for NixEvalJobs {
command
.arg("--workers")
.arg(self.workers.to_string())
.args(&["--expr", &expression.expression()]);
.args(["--expr", &expression.expression()]);
command.args(flags.to_args());
if expression.requires_flakes() {
command.args(&["--extra-experimental-features", "flakes"]);
command.args(["--extra-experimental-features", "flakes"]);
}
let mut child = command

View file

@ -87,8 +87,8 @@ impl FlakeMetadata {
/// Resolves a flake.
async fn resolve(flake: &str) -> ColmenaResult<Self> {
let child = Command::new("nix")
.args(&["flake", "metadata", "--json"])
.args(&["--extra-experimental-features", "nix-command flakes"])
.args(["flake", "metadata", "--json"])
.args(["--extra-experimental-features", "nix-command flakes"])
.arg(flake)
.stdout(Stdio::piped())
.spawn()?;
@ -109,8 +109,8 @@ impl FlakeMetadata {
/// Quietly locks the dependencies of a flake.
pub async fn lock_flake_quiet(uri: &str) -> ColmenaResult<()> {
let status = Command::new("nix")
.args(&["flake", "lock"])
.args(&["--extra-experimental-features", "nix-command flakes"])
.args(["flake", "lock"])
.args(["--extra-experimental-features", "nix-command flakes"])
.arg(uri)
.stderr(Stdio::null())
.status()

View file

@ -416,7 +416,7 @@ impl<'hive> NixInstantiate<'hive> {
let mut command = Command::new("nix-instantiate");
if self.hive.is_flake() {
command.args(&["--extra-experimental-features", "flakes"]);
command.args(["--extra-experimental-features", "flakes"]);
}
let mut full_expression = self.hive.get_base_expression();

View file

@ -104,13 +104,12 @@ impl Host for Local {
async fn get_current_system_profile(&mut self) -> ColmenaResult<Profile> {
let paths = Command::new("readlink")
.args(&["-e", CURRENT_PROFILE])
.args(["-e", CURRENT_PROFILE])
.capture_output()
.await?;
let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()
@ -121,7 +120,7 @@ impl Host for Local {
async fn get_main_system_profile(&mut self) -> ColmenaResult<Profile> {
let paths = Command::new("sh")
.args(&[
.args([
"-c",
&format!(
"readlink -e {} || readlink -e {}",
@ -133,7 +132,6 @@ impl Host for Local {
let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()

View file

@ -112,7 +112,6 @@ impl Host for Ssh {
let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()
@ -131,7 +130,6 @@ impl Host for Ssh {
let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()
@ -265,7 +263,7 @@ impl Ssh {
// experimental `nix copy` command with ssh-ng://
let mut command = Command::new("nix");
command.args(&[
command.args([
"--extra-experimental-features",
"nix-command",
"copy",
@ -273,7 +271,7 @@ impl Ssh {
]);
if options.use_substitutes {
command.args(&[
command.args([
"--substitute-on-destination",
// needed due to UX bug in ssh-ng://
"--builders-use-substitutes",

View file

@ -81,7 +81,7 @@ impl NixCheck {
let flakes_supported = version.has_flakes();
let flake_cmd = Command::new("nix-instantiate")
.args(&["--eval", "-E", "builtins.getFlake"])
.args(["--eval", "-E", "builtins.getFlake"])
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()

View file

@ -53,13 +53,13 @@ impl Profile {
/// Create a GC root for this profile.
pub async fn create_gc_root(&self, path: &Path) -> ColmenaResult<()> {
let mut command = Command::new("nix-store");
command.args(&[
command.args([
"--no-build-output",
"--indirect",
"--add-root",
path.to_str().unwrap(),
]);
command.args(&["--realise", self.as_path().to_str().unwrap()]);
command.args(["--realise", self.as_path().to_str().unwrap()]);
command.stdout(Stdio::null());
let status = command.status().await?;

View file

@ -46,7 +46,7 @@ impl StorePath {
/// Returns the immediate dependencies of the store path.
pub async fn references(&self) -> ColmenaResult<Vec<StorePath>> {
let references = Command::new("nix-store")
.args(&["--query", "--references"])
.args(["--query", "--references"])
.arg(&self.0)
.capture_output()
.await?

View file

@ -279,7 +279,7 @@ pub async fn hive_from_path(hive_path: HivePath, args: &ArgMatches) -> ColmenaRe
}
if let Some(opts) = args.get_many::<String>("nix-option") {
let iter = opts.into_iter();
let iter = opts;
let names = iter.clone().step_by(2);
let values = iter.clone().skip(1).step_by(2);