Skip to content

Commit

Permalink
Fix 1.77.0 package id stabilization (#639)
Browse files Browse the repository at this point in the history
I yanked tame-index because of build breakage, but this means the
default of cargo-install not using --locked breaks.

Resolves: #640
  • Loading branch information
Jake-Shadle authored Mar 21, 2024
1 parent 5e30d44 commit 4ce0a91
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 65 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- next-header -->
## [Unreleased] - ReleaseDate
### Changed
- [PR#639](https://github.com/EmbarkStudios/cargo-deny/pull/639) updated tame-index to avoid an error if you don't used `--locked`.

## [0.14.18] - 2024-03-21
### Fixed
- [PR#638](https://github.com/EmbarkStudios/cargo-deny/pull/638) resolved [#636](https://github.com/EmbarkStudios/cargo-deny/issues/636) by updating `krates`.
Expand Down
86 changes: 46 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ spdx = "0.10"
# Lazy
strum = { version = "0.26", features = ["derive"] }
# Index retrieval and querying
tame-index = { version = "0.9", default-features = false, features = [
tame-index = { version = "0.10", default-features = false, features = [
"git",
"sparse",
] }
Expand Down Expand Up @@ -136,7 +136,7 @@ features = [
fs_extra = "1.3"
# Snapshot testing
insta = { version = "1.21", features = ["json"] }
tame-index = { version = "0.9", features = ["local-builder"] }
tame-index = { version = "0.10", features = ["local-builder"] }
time = { version = "0.3", features = ["serde"] }
toml-span = { version = "0.2", features = ["serde"] }
# We use this for creating fake crate directories for crawling license files on disk
Expand Down
1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ deny = [
skip = [
{ crate = "[email protected]", reason = "https://github.com/seanmonstar/reqwest/pull/2130 should be in the next version" },
{ crate = "[email protected]", reason = "gix 0.59 was yanked, see https://github.com/Byron/gitoxide/issues/1309" },
{ crate = "[email protected]", reason = "strum_macros uses this old version" },
]
skip-tree = [
{ crate = "[email protected]", reason = "a foundational crate for many that bumps far too frequently to ever have a shared version" },
Expand Down
4 changes: 1 addition & 3 deletions src/bans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,7 @@ pub fn check(
drop(tx);
},
|| {
let Some((build_config, rx)) = rx else {
return None;
};
let (build_config, rx) = rx?;

// Keep track of the individual crate configs so we can emit warnings
// if they're configured but not actually used
Expand Down
34 changes: 17 additions & 17 deletions src/bans/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use anyhow::{Context, Error};
use krates::petgraph as pg;
use semver::Version;
use std::{
borrow::Cow,
collections::{btree_map::Entry, BTreeMap, HashSet},
fmt,
};
Expand Down Expand Up @@ -52,7 +53,7 @@ pub enum Style {

#[derive(Default)]
struct NodeAttributes<'a> {
label: Option<&'a str>,
label: Option<Cow<'a, str>>,
shape: Option<Shape>,
style: Option<Style>,
color: Option<&'static str>,
Expand Down Expand Up @@ -219,8 +220,7 @@ pub(crate) fn create_graph(

while let Some(nid) = node_stack.pop() {
let node = &graph[nid];
let mut iditer = node.kid.repr.splitn(3, ' ');
let name = iditer.next().unwrap();
let name = node.kid.name();

match dupe_nodes.entry(name) {
Entry::Occupied(it) => {
Expand Down Expand Up @@ -268,27 +268,27 @@ pub(crate) fn create_graph(
|node| {
let node_weight = node.weight();

if let Some(feat) = &node_weight.feature {
if let Some(feat) = node_weight.feature {
NodeAttributes {
label: Some(feat),
label: Some(feat.into()),
shape: Some(Shape::diamond),
..Default::default()
}
} else {
let repr = &node_weight.kid.repr;
let kid = node_weight.kid;

let mut i = repr.splitn(3, ' ');
let name = i.next().unwrap();
let _version = i.next().unwrap();
let source = i.next().unwrap();
let name = kid.name();
let version = kid.version();
let source = kid.source();

if dupe_nodes.contains_key(name) {
let label =
if source != "(registry+https://github.com/rust-lang/crates.io-index)" {
&repr[name.len() + 1..]
} else {
&repr[name.len() + 1..repr.len() - source.len() - 1]
};
// Add the source only if it is not crates.io
let label = if source != "registry+https://github.com/rust-lang/crates.io-index"
{
format!("{version} {source}").into()
} else {
version.into()
};

NodeAttributes {
label: Some(label),
Expand All @@ -299,7 +299,7 @@ pub(crate) fn create_graph(
}
} else {
NodeAttributes {
label: Some(&repr[0..repr.len() - source.len() - 1]),
label: Some(format!("{name} {version}").into()),
shape: Some(Shape::r#box),
style: Some(Style::rounded),
..Default::default()
Expand Down
4 changes: 1 addition & 3 deletions src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ pub fn deprecated<'de, T>(
where
T: toml_span::Deserialize<'de>,
{
let Some((k, mut v)) = th.take(field) else {
return None;
};
let (k, mut v) = th.take(field)?;
spans.push(k.span);

match T::deserialize(&mut v) {
Expand Down

0 comments on commit 4ce0a91

Please sign in to comment.