Skip to content

Commit 7db69a8

Browse files
committed
dev: run cargo clippy
1 parent a671f01 commit 7db69a8

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

devenv-eval-cache/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ mod integration_tests {
4242

4343
fn get_nix_binary() -> Result<String, Box<dyn std::error::Error>> {
4444
match env::var("DEVENV_NIX") {
45-
Ok(path) => Ok(format!("{}/bin/nix", path)),
46-
Err(_) => Err(format!(
47-
"DEVENV_NIX environment variable not set. \
45+
Ok(path) => Ok(format!("{path}/bin/nix")),
46+
Err(_) => Err("DEVENV_NIX environment variable not set. \
4847
Please set DEVENV_NIX to point to the store path of the custom Nix build. \
49-
Example: DEVENV_NIX=/nix/store/...-nix-devenv-2.30.0... cargo test --features integration-tests"
50-
).into())
48+
Example: DEVENV_NIX=/nix/store/...-nix-devenv-2.30.0... cargo test --features integration-tests".to_string().into())
5149
}
5250
}
5351

@@ -77,7 +75,7 @@ mod integration_tests {
7775
let nix_binary = get_nix_binary()?;
7876
let cached_cmd = CachedCommand::new(pool);
7977
let mut cmd = Command::new(nix_binary);
80-
cmd.args(&["eval", "--impure", "--expr", expr]);
78+
cmd.args(["eval", "--impure", "--expr", expr]);
8179

8280
Ok(cached_cmd.output(&mut cmd).await?)
8381
}
@@ -209,7 +207,7 @@ mod integration_tests {
209207
env::set_var(test_env_var, test_env_value);
210208
}
211209

212-
let nix_expr = format!(r#"builtins.getEnv "{}""#, test_env_var);
210+
let nix_expr = format!(r#"builtins.getEnv "{test_env_var}""#);
213211

214212
// Run nix eval with caching
215213
let output = run_nix_eval_cached(&pool, &nix_expr).await?;
@@ -329,7 +327,7 @@ mod integration_tests {
329327
pool: sqlx::SqlitePool,
330328
) -> Result<(), Box<dyn std::error::Error>> {
331329
let test_env_var = "TEST_CACHE_INVALIDATION_VAR";
332-
let nix_expr = format!(r#"builtins.getEnv "{}""#, test_env_var);
330+
let nix_expr = format!(r#"builtins.getEnv "{test_env_var}""#);
333331

334332
// Set initial value
335333
unsafe {

devenv/src/mcp.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ mod tests {
462462
let packages = server.fetch_packages().await;
463463

464464
// Should be able to fetch packages without error
465-
assert!(packages.is_ok(), "Failed to fetch packages: {:?}", packages);
465+
assert!(packages.is_ok(), "Failed to fetch packages: {packages:?}");
466466

467467
let packages = packages.unwrap();
468468

@@ -540,8 +540,7 @@ mod tests {
540540
for known_option in known_options {
541541
assert!(
542542
options.iter().any(|opt| opt.name == known_option),
543-
"Expected option '{}' not found",
544-
known_option
543+
"Expected option '{known_option}' not found"
545544
);
546545
}
547546

@@ -562,7 +561,7 @@ mod tests {
562561
}
563562
Err(e) => {
564563
// Expected to fail in test environment
565-
eprintln!("Expected failure in test environment: {:?}", e);
564+
eprintln!("Expected failure in test environment: {e:?}");
566565
eprintln!(
567566
"This test requires running from a devenv project root with proper setup"
568567
);

devenv/src/snix_backend.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
//! This module provides a Rust-native Nix evaluator backend using Snix
44
//! as an alternative to the traditional C++ Nix binary.
55
6-
#![cfg(feature = "snix")]
7-
86
use crate::nix_backend::{DevenvPaths, NixBackend, Options};
97
use crate::{cli, config};
108
use async_trait::async_trait;
119
use devenv_eval_cache::Output;
12-
use miette::{bail, Result};
10+
use miette::{Result, bail};
1311
use snix_build::buildservice::{BuildService, DummyBuildService};
1412
use snix_castore::blobservice::from_addr as blob_from_addr;
1513
use snix_castore::directoryservice::from_addr as directory_from_addr;
@@ -125,7 +123,9 @@ impl NixBackend for SnixBackend {
125123
async fn dev_env(&self, _json: bool, _gc_root: &Path) -> Result<Output> {
126124
// TODO: This is a complex operation that requires implementing the equivalent
127125
// of `nix print-dev-env`. For now, we'll return a placeholder error.
128-
bail!("dev_env is not yet implemented for Snix backend. This requires implementing shell environment generation.")
126+
bail!(
127+
"dev_env is not yet implemented for Snix backend. This requires implementing shell environment generation."
128+
)
129129
}
130130

131131
async fn add_gc(&self, _name: &str, _path: &Path) -> Result<()> {
@@ -157,7 +157,7 @@ impl NixBackend for SnixBackend {
157157
} else {
158158
// Build an attribute path expression like ".#foo.bar"
159159
let attr_path = attributes.join(".");
160-
format!("(import ./flake.nix).{}", attr_path)
160+
format!("(import ./flake.nix).{attr_path}")
161161
};
162162

163163
// For now, return a placeholder - proper implementation would need generator context

0 commit comments

Comments
 (0)