From f04c764435711e661b34972780fc460fc11308a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kj=C3=A4ll?= Date: Tue, 31 Mar 2026 16:44:35 +0200 Subject: [PATCH] upgrade cargo metadata to 0.23 --- Cargo.lock | 35 ++++++++++++++++++++++++++++------- Cargo.toml | 2 +- src/lib.rs | 10 +++++++--- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea72305..c791307 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,25 +99,26 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.9" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +checksum = "87a0c0e6148f11f01f32650a2ea02d532b2ad4e81d8bd41e6e565b5adc5e6082" dependencies = [ "serde", + "serde_core", ] [[package]] name = "cargo_metadata" -version = "0.18.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", - "thiserror", + "thiserror 2.0.18", ] [[package]] @@ -253,7 +254,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ddf7a5e441e8003a5a88aab97f1c6113043ddde252d789ef9dea3871b78633a" dependencies = [ - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -385,7 +386,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", ] [[package]] @@ -399,6 +409,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "toml" version = "0.9.7" diff --git a/Cargo.toml b/Cargo.toml index 1949bc8..b8c7d0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ version = "0.4.0" rust-version = "1.78.0" [dependencies] -cargo_metadata = "0.18.1" +cargo_metadata = "0.23" clap = { version = "4.4.8", features = ["cargo", "wrap_help", "string"] } regex = "1.5" rustc-cfg = "0.5" diff --git a/src/lib.rs b/src/lib.rs index 15050f4..4a566e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ use std::{env, str}; use anyhow::{bail, Result}; use cargo_metadata::camino::Utf8Component; -use cargo_metadata::{Artifact, CargoOpt, Message, Metadata, MetadataCommand}; +use cargo_metadata::{Artifact, CargoOpt, Message, Metadata, MetadataCommand, TargetKind}; use clap::{Arg, ArgAction, ArgMatches, Command as ClapCommand}; use rustc_cfg::Cfg; @@ -134,10 +134,14 @@ impl BuildType<'_> { .target .kind .iter() - .any(|s| s == "bin" || s == "example"), + .any(|s| s == &TargetKind::Bin || s == &TargetKind::Example), // Since LibKind can be an arbitrary string `LibKind:Other(String)` we filter by what it can't be BuildType::Lib => artifact.target.kind.iter().any(|s| { - s != "bin" && s != "example" && s != "test" && s != "custom-build" && s != "bench" + s != &TargetKind::Bin + && s != &TargetKind::Example + && s != &TargetKind::Test + && s != &TargetKind::CustomBuild + && s != &TargetKind::Bench }), } }