Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Jun 18, 2024
1 parent eaadf29 commit e5d3b9c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ strum = { version = "0.26", features = ["derive"] }
# Index retrieval and querying
tame-index = { version = "0.12", default-features = false, features = [
"git",
"local",
"sparse",
] }
# Timestamp emission
Expand Down
28 changes: 12 additions & 16 deletions src/advisories/helpers/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ impl<'k> Indices<'k> {
let cache = set
.into_par_iter()
.map(|(name, src)| {
let read_entry = || -> Result<YankMap, String> {
match indices
let read_entry = || -> Result<Entry, String> {
let res = match indices
.iter()
.find_map(|(url, index)| (src == *url).then_some(index))
.ok_or_else(|| "unable to locate index".to_owned())?
Expand All @@ -90,25 +90,21 @@ impl<'k> Indices<'k> {
) {
Ok(Some(ik)) => {
let yank_map = Self::load_index_krate(ik);
Ok(yank_map)
Entry::Map(yank_map)
}
Ok(None) => {
Err("unable to locate index entry for crate".to_owned())
}
Err(err) => Err(format!("{err:#}")),
Ok(None) => Entry::Error(
"unable to locate index entry for crate".to_owned(),
),
Err(err) => Entry::Error(format!("{err:#}")),
}
}
Err(err) => Err(format!("{err:#}")),
}
Err(err) => Entry::Error(format!("{err:#}")),
};

Ok(res)
};

(
(name, src),
match read_entry() {
Ok(ym) => Entry::Map(ym),
Err(err) => Entry::Error(err),
},
)
((name, src), read_entry().unwrap_or_else(Entry::Error))
})
.collect();

Expand Down
6 changes: 3 additions & 3 deletions src/bans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ impl TreeSkipper {
krate_id: krates::NodeId,
krates: &Krates,
) -> SkipRoot {
let (max_depth, reason) = ts.inner.map_or((std::usize::MAX, None), |inn| {
(inn.depth.unwrap_or(std::usize::MAX), inn.reason)
let (max_depth, reason) = ts.inner.map_or((usize::MAX, None), |inn| {
(inn.depth.unwrap_or(usize::MAX), inn.reason)
});

let mut skip_crates = Vec::with_capacity(10);
Expand Down Expand Up @@ -396,7 +396,7 @@ pub fn check(
LintLevel::Allow => return,
};

let mut all_start = std::usize::MAX;
let mut all_start = usize::MAX;
let mut all_end = 0;

struct Dupe {
Expand Down
1 change: 1 addition & 0 deletions src/cargo-deny/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub struct KrateContext {
pub offline: bool,
/// If true, allows using the crates.io git index, otherwise the sparse index
/// is assumed to be the only index
#[allow(dead_code)]
pub allow_git_index: bool,
pub exclude_dev: bool,
}
Expand Down

0 comments on commit e5d3b9c

Please sign in to comment.