Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependecy resolution on rust 1.77 #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions skeptic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ glob = "0.3"
pulldown-cmark = { version = "0.9", default-features = false }
tempfile = "3"
walkdir = "2.2"
rustversion = "1.0"

[dev-dependencies]
unindent = "0.2"
9 changes: 9 additions & 0 deletions skeptic/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

// This has to come before "-L".
let metadata_path = root_dir.join("Cargo.toml");
let metadata = get_cargo_meta(&metadata_path).expect("failed to read Cargo.toml");

Check failure on line 74 in skeptic/src/rt.rs

View workflow job for this annotation

GitHub Actions / Lint

the borrowed expression implements the required traits
let edition = metadata
.packages
.iter()
Expand Down Expand Up @@ -214,6 +214,15 @@
impl Iterator for LockedDeps {
type Item = (String, String);

#[rustversion::since(1.77)]
fn next(&mut self) -> Option<(String, String)> {
let dep = self.dependencies.pop()?;
let (path, version) = dep.rsplit_once(&['#', '@'])?;
let (_, name) = path.rsplit_once(&['/', '#'])?;
Some((name.replace('-', "_"), version.to_owned()))
}

#[rustversion::before(1.77)]
fn next(&mut self) -> Option<(String, String)> {
let dep = self.dependencies.pop()?;
let mut parts = dep.split_whitespace();
Expand Down
Loading