about summary refs log tree commit diff
path: root/tvix/nix_cli/src
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-08-19T15·18+0200
committerflokli <flokli@flokli.de>2023-08-20T21·51+0000
commitbc852fa56f3ac4ea1d506a0296c27ecb91a7589d (patch)
tree76cf6a5c2dd6c960f1ed044b9fa4ad5c5a567804 /tvix/nix_cli/src
parent146175b83d8a5422810ed628d46d00656ab7f95d (diff)
refactor(tvix/nix_cli): cargo clippy r/6499
Change-Id: Ib48063660432bea9de2fc9aff5914ef76db3ad64
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9095
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix_cli/src')
-rw-r--r--tvix/nix_cli/src/bin/nix-store.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/nix_cli/src/bin/nix-store.rs b/tvix/nix_cli/src/bin/nix-store.rs
index c6f7d00a4df8..89b33dd817a4 100644
--- a/tvix/nix_cli/src/bin/nix-store.rs
+++ b/tvix/nix_cli/src/bin/nix-store.rs
@@ -8,8 +8,8 @@ pub fn main_args(args: Vec<String>) -> clap::error::Result<NixResult> {
         .try_get_matches_from(args.iter())?;
     if let Some(add) = matches.subcommand_matches("--add") {
         let file = add.get_one::<String>("FILE").expect("--add needs a file");
-        let file_contents =
-            std::fs::read_to_string(file).expect(&format!("file {} does not exist", file));
+        let file_contents = std::fs::read_to_string(file)
+            .unwrap_or_else(|_| panic!("file {} does not exist", file));
         Ok(NixResult::FileAddedToStore {
             content: file_contents,
         })
@@ -47,7 +47,7 @@ mod integration_tests {
         let out = std::process::Command::new(cmd)
             .args(args)
             .output()
-            .expect(&format!("could not run {}", cmd));
+            .unwrap_or_else(|_| panic!("could not run {}", cmd));
         match out.status.code().expect("no status code!") {
             0 => NixOutput::Ok {
                 stdout: String::from_utf8_lossy(&out.stdout).trim_end().to_string(),
@@ -66,7 +66,7 @@ mod integration_tests {
             err @ NixOutput::Err { .. } => panic!("nix-store --add failed: {:#?}", err),
             NixOutput::Ok { stdout, .. } => NixResult::FileAddedToStore {
                 content: std::fs::read_to_string(&stdout)
-                    .expect(&format!("cannot open {} as store file", stdout)),
+                    .unwrap_or_else(|_| panic!("cannot open {} as store file", stdout)),
             },
         }
     }