Skip to content

Commit be31fea

Browse files
authored
Merge pull request #375 from pnmadelaine/fix-cargo-test
Fix cargo tests & clippy warnings
2 parents a308f26 + 04ffee4 commit be31fea

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

crate2nix/src/config.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,7 @@ impl Display for Source {
196196
sha256,
197197
registry,
198198
..
199-
} => write!(
200-
f,
201-
"{} {} from {}: {}",
202-
name,
203-
version,
204-
registry.to_string(),
205-
sha256
206-
),
199+
} => write!(f, "{} {} from {}: {}", name, version, registry, sha256),
207200
Source::Git { url, rev, sha256 } => write!(f, "{}#{} via git: {}", url, rev, sha256),
208201
Source::Nix { file, attr: None } => write!(f, "{}", file),
209202
Source::Nix {

crate2nix/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn prefetch_and_fill_registries(
225225
config: &GenerateConfig,
226226
default_nix: &mut BuildInfo,
227227
) -> Result<(), Error> {
228-
default_nix.registries = prefetch::prefetch_registries(config, &mut default_nix.crates)
228+
default_nix.registries = prefetch::prefetch_registries(config, &default_nix.crates)
229229
.map_err(|e| format_err!("while prefetching crates for calculating sha256: {}", e))?;
230230

231231
Ok(())

crate2nix/src/prefetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub fn prefetch_registries(
202202
&[&format!(
203203
"{}{}config.json",
204204
e.key(),
205-
if e.key().ends_with("/") { "" } else { "/" }
205+
if e.key().ends_with('/') { "" } else { "/" }
206206
)],
207207
)?;
208208
e.insert(out);

crate2nix/src/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn generate_config() -> crate::GenerateConfig {
1313
output: "Cargo.nix".into(),
1414
use_cargo_lock_checksums: true,
1515
read_crate_hashes: true,
16+
registry_hashes_json: "registry-hashes.json".into(),
1617
}
1718
}
1819

crate2nix/tests/self_build_up_to_date.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fn self_up_to_date() {
3434
other_metadata_options: vec![],
3535
use_cargo_lock_checksums: true,
3636
read_crate_hashes: true,
37+
registry_hashes_json: PathBuf::from("./registry-hashes.json"),
3738
},
3839
)
3940
.unwrap();
@@ -79,6 +80,9 @@ fn assert_up_to_date(project_dir: &Path) {
7980
other_metadata_options: vec![],
8081
use_cargo_lock_checksums: true,
8182
read_crate_hashes: true,
83+
registry_hashes_json: PathBuf::from("../")
84+
.join(project_dir)
85+
.join("./registry-hashes.json"),
8286
};
8387
let metadata = BuildInfo::for_config(
8488
&GenerateInfo {

0 commit comments

Comments
 (0)