Skip to content

Commit 4ce0a91

Browse files
authored
Fix 1.77.0 package id stabilization (#639)
I yanked tame-index because of build breakage, but this means the default of cargo-install not using --locked breaks. Resolves: #640
1 parent 5e30d44 commit 4ce0a91

File tree

7 files changed

+71
-65
lines changed

7 files changed

+71
-65
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
<!-- next-header -->
1010
## [Unreleased] - ReleaseDate
11+
### Changed
12+
- [PR#639](https://github.com/EmbarkStudios/cargo-deny/pull/639) updated tame-index to avoid an error if you don't used `--locked`.
13+
1114
## [0.14.18] - 2024-03-21
1215
### Fixed
1316
- [PR#638](https://github.com/EmbarkStudios/cargo-deny/pull/638) resolved [#636](https://github.com/EmbarkStudios/cargo-deny/issues/636) by updating `krates`.

Cargo.lock

Lines changed: 46 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ spdx = "0.10"
101101
# Lazy
102102
strum = { version = "0.26", features = ["derive"] }
103103
# Index retrieval and querying
104-
tame-index = { version = "0.9", default-features = false, features = [
104+
tame-index = { version = "0.10", default-features = false, features = [
105105
"git",
106106
"sparse",
107107
] }
@@ -136,7 +136,7 @@ features = [
136136
fs_extra = "1.3"
137137
# Snapshot testing
138138
insta = { version = "1.21", features = ["json"] }
139-
tame-index = { version = "0.9", features = ["local-builder"] }
139+
tame-index = { version = "0.10", features = ["local-builder"] }
140140
time = { version = "0.3", features = ["serde"] }
141141
toml-span = { version = "0.2", features = ["serde"] }
142142
# We use this for creating fake crate directories for crawling license files on disk

deny.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ deny = [
3030
skip = [
3131
{ crate = "[email protected]", reason = "https://github.com/seanmonstar/reqwest/pull/2130 should be in the next version" },
3232
{ crate = "[email protected]", reason = "gix 0.59 was yanked, see https://github.com/Byron/gitoxide/issues/1309" },
33+
{ crate = "[email protected]", reason = "strum_macros uses this old version" },
3334
]
3435
skip-tree = [
3536
{ crate = "[email protected]", reason = "a foundational crate for many that bumps far too frequently to ever have a shared version" },

src/bans.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,7 @@ pub fn check(
887887
drop(tx);
888888
},
889889
|| {
890-
let Some((build_config, rx)) = rx else {
891-
return None;
892-
};
890+
let (build_config, rx) = rx?;
893891

894892
// Keep track of the individual crate configs so we can emit warnings
895893
// if they're configured but not actually used

src/bans/graph.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use anyhow::{Context, Error};
44
use krates::petgraph as pg;
55
use semver::Version;
66
use std::{
7+
borrow::Cow,
78
collections::{btree_map::Entry, BTreeMap, HashSet},
89
fmt,
910
};
@@ -52,7 +53,7 @@ pub enum Style {
5253

5354
#[derive(Default)]
5455
struct NodeAttributes<'a> {
55-
label: Option<&'a str>,
56+
label: Option<Cow<'a, str>>,
5657
shape: Option<Shape>,
5758
style: Option<Style>,
5859
color: Option<&'static str>,
@@ -219,8 +220,7 @@ pub(crate) fn create_graph(
219220

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

225225
match dupe_nodes.entry(name) {
226226
Entry::Occupied(it) => {
@@ -268,27 +268,27 @@ pub(crate) fn create_graph(
268268
|node| {
269269
let node_weight = node.weight();
270270

271-
if let Some(feat) = &node_weight.feature {
271+
if let Some(feat) = node_weight.feature {
272272
NodeAttributes {
273-
label: Some(feat),
273+
label: Some(feat.into()),
274274
shape: Some(Shape::diamond),
275275
..Default::default()
276276
}
277277
} else {
278-
let repr = &node_weight.kid.repr;
278+
let kid = node_weight.kid;
279279

280-
let mut i = repr.splitn(3, ' ');
281-
let name = i.next().unwrap();
282-
let _version = i.next().unwrap();
283-
let source = i.next().unwrap();
280+
let name = kid.name();
281+
let version = kid.version();
282+
let source = kid.source();
284283

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

293293
NodeAttributes {
294294
label: Some(label),
@@ -299,7 +299,7 @@ pub(crate) fn create_graph(
299299
}
300300
} else {
301301
NodeAttributes {
302-
label: Some(&repr[0..repr.len() - source.len() - 1]),
302+
label: Some(format!("{name} {version}").into()),
303303
shape: Some(Shape::r#box),
304304
style: Some(Style::rounded),
305305
..Default::default()

src/cfg.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ pub fn deprecated<'de, T>(
8383
where
8484
T: toml_span::Deserialize<'de>,
8585
{
86-
let Some((k, mut v)) = th.take(field) else {
87-
return None;
88-
};
86+
let (k, mut v) = th.take(field)?;
8987
spans.push(k.span);
9088

9189
match T::deserialize(&mut v) {

0 commit comments

Comments
 (0)