Skip to content

Commit

Permalink
cargo clippy --all-targets --fix
Browse files Browse the repository at this point in the history
Suggested in #169, I just ran it myself.

Co-authored-by: i1i1 <vanyarybin1@live.ru>
  • Loading branch information
zhaofengli and i1i1 committed Oct 18, 2023
1 parent 82c8c70 commit 8d92dad
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/command/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/nix/evaluator/nix_eval_jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/nix/flake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/nix/hive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 2 additions & 4 deletions src/nix/host/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 {}",
Expand All @@ -133,7 +132,6 @@ impl Host for Local {

let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()
Expand Down
6 changes: 2 additions & 4 deletions src/nix/host/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl Host for Ssh {

let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()
Expand All @@ -131,7 +130,6 @@ impl Host for Ssh {

let path = paths
.lines()
.into_iter()
.next()
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
.to_string()
Expand Down Expand Up @@ -265,15 +263,15 @@ 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",
"--no-check-sigs",
]);

if options.use_substitutes {
command.args(&[
command.args([
"--substitute-on-destination",
// needed due to UX bug in ssh-ng://
"--builders-use-substitutes",
Expand Down
2 changes: 1 addition & 1 deletion src/nix/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/nix/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
2 changes: 1 addition & 1 deletion src/nix/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8d92dad

Please sign in to comment.