Skip to content

Commit

Permalink
Merge pull request #375 from pnmadelaine/fix-cargo-test
Browse files Browse the repository at this point in the history
Fix cargo tests & clippy warnings
  • Loading branch information
Ericson2314 authored Feb 13, 2025
2 parents a308f26 + 04ffee4 commit be31fea
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
9 changes: 1 addition & 8 deletions crate2nix/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,7 @@ impl Display for Source {
sha256,
registry,
..
} => write!(
f,
"{} {} from {}: {}",
name,
version,
registry.to_string(),
sha256
),
} => write!(f, "{} {} from {}: {}", name, version, registry, sha256),
Source::Git { url, rev, sha256 } => write!(f, "{}#{} via git: {}", url, rev, sha256),
Source::Nix { file, attr: None } => write!(f, "{}", file),
Source::Nix {
Expand Down
2 changes: 1 addition & 1 deletion crate2nix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn prefetch_and_fill_registries(
config: &GenerateConfig,
default_nix: &mut BuildInfo,
) -> Result<(), Error> {
default_nix.registries = prefetch::prefetch_registries(config, &mut default_nix.crates)
default_nix.registries = prefetch::prefetch_registries(config, &default_nix.crates)
.map_err(|e| format_err!("while prefetching crates for calculating sha256: {}", e))?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crate2nix/src/prefetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub fn prefetch_registries(
&[&format!(
"{}{}config.json",
e.key(),
if e.key().ends_with("/") { "" } else { "/" }
if e.key().ends_with('/') { "" } else { "/" }
)],
)?;
e.insert(out);
Expand Down
1 change: 1 addition & 0 deletions crate2nix/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub fn generate_config() -> crate::GenerateConfig {
output: "Cargo.nix".into(),
use_cargo_lock_checksums: true,
read_crate_hashes: true,
registry_hashes_json: "registry-hashes.json".into(),
}
}

Expand Down
4 changes: 4 additions & 0 deletions crate2nix/tests/self_build_up_to_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fn self_up_to_date() {
other_metadata_options: vec![],
use_cargo_lock_checksums: true,
read_crate_hashes: true,
registry_hashes_json: PathBuf::from("./registry-hashes.json"),
},
)
.unwrap();
Expand Down Expand Up @@ -79,6 +80,9 @@ fn assert_up_to_date(project_dir: &Path) {
other_metadata_options: vec![],
use_cargo_lock_checksums: true,
read_crate_hashes: true,
registry_hashes_json: PathBuf::from("../")
.join(project_dir)
.join("./registry-hashes.json"),
};
let metadata = BuildInfo::for_config(
&GenerateInfo {
Expand Down

0 comments on commit be31fea

Please sign in to comment.