From de40608cc9c89d6ff47b59dadd8bdac74d60f2c6 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Thu, 25 Jul 2024 17:52:53 +0200 Subject: [PATCH] Prep release (#676) --- .github/workflows/ci.yaml | 2 +- CHANGELOG.md | 13 +++ Cargo.lock | 95 +++++++++--------- Cargo.toml | 6 +- docs/src/checks/advisories/diags.md | 1 + docs/src/checks/bans/cfg.md | 16 ++++ docs/src/checks/bans/diags.md | 13 +++ docs/src/checks/licenses/diags.md | 1 + docs/src/checks/sources/diags.md | 1 + src/advisories/helpers/db.rs | 4 +- src/bans.rs | 1 + src/cargo-deny/common.rs | 96 ------------------- tests/feature_bans.rs | 3 +- .../workspace/crates/member-two/src/lib.rs | 13 --- 14 files changed, 101 insertions(+), 164 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 63df47a02..ce6df94b3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -86,7 +86,7 @@ jobs: # Also, build and run with musl, this lets us ensure that # musl still works, which is important for the linux binaries # we release, but wasn't exercised until now - run: cargo install --path . --debug --target ${{ matrix.target }} + run: cargo install --locked --path . --debug --target ${{ matrix.target }} - name: self check run: cargo deny -L debug --all-features --locked check # - name: check external users diff --git a/CHANGELOG.md b/CHANGELOG.md index 2146084d6..ca2e0d9d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +### Added +- [PR#673](https://github.com/EmbarkStudios/cargo-deny/pull/673) added linting of `[workspace.dependencies]`, resolving [#436](https://github.com/EmbarkStudios/cargo-deny/issues/436) and [#525](https://github.com/EmbarkStudios/cargo-deny/issues/525). + - Added lint [`workspace-duplicates`](https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html#the-workspace-duplicates-field-optional), which allows checking for missing usage of `workspace = true` for direct workspace dependencies that are used more than once in the workspace. + - Added lint [`unused-workspace-dependencies`](https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html#the-unused-workspace-dependencies-field-optional), which allows checking for dependencies declared in `[workspace.dependencies]` that aren't actually used. + +### Changed +- [PR#673](https://github.com/EmbarkStudios/cargo-deny/pull/673) changed how span information for workspace dependencies worked, which meant improvements were made to the output for the `bans.wildcards` lint. Previously fake cargo manifests were created that weren't even necessarily valid toml files, however now the actual cargo manifests are used, meaning that the lint will now point to the correct file and line location of the dependency declaration that uses a wildcard. +- [PR#675](https://github.com/EmbarkStudios/cargo-deny/pull/675) changed the utf-8 characters used in rendering diagnostics, inspired by [rust-lang/rust#126597](https://github.com/rust-lang/rust/pull/126597). +- [PR#676](https://github.com/EmbarkStudios/cargo-deny/pull/676) updated notably `gix` -> 0.64 (and tame-index). + +### Fixed +- [PR#668](https://github.com/EmbarkStudios/cargo-deny/pull/668) resolved [#667](https://github.com/EmbarkStudios/cargo-deny/issues/667) by adding a missing feature flag to allow local cargo registry support. + ## [0.14.24] - 2024-05-24 ### Changed - [PR#663](https://github.com/EmbarkStudios/cargo-deny/pull/663) updated some crates, notably `gix` -> 0.63 (and tame-index). diff --git a/Cargo.lock b/Cargo.lock index be7128b18..33a24f5cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,9 +46,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -61,33 +61,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -324,9 +324,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.10" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" +checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" dependencies = [ "clap_builder", "clap_derive", @@ -334,9 +334,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.10" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" +checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" dependencies = [ "anstream", "anstyle", @@ -346,9 +346,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" dependencies = [ "heck", "proc-macro2", @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "clru" @@ -391,9 +391,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "console" @@ -743,9 +743,9 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gix" -version = "0.63.0" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06" +checksum = "d78414d29fcc82329080166077e0f7689f4016551fdb334d787c3d040fe2634f" dependencies = [ "gix-actor", "gix-attributes", @@ -807,7 +807,7 @@ dependencies = [ "gix-utils", "itoa", "thiserror", - "winnow 0.6.15", + "winnow 0.6.16", ] [[package]] @@ -873,9 +873,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840" +checksum = "28f53fd03d1bf09ebcc2c8654f08969439c4556e644ca925f27cf033bc43e658" dependencies = [ "bstr", "gix-config-value", @@ -889,7 +889,7 @@ dependencies = [ "smallvec", "thiserror", "unicode-bom", - "winnow 0.6.15", + "winnow 0.6.16", ] [[package]] @@ -948,9 +948,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf" +checksum = "67662731cec3cb31ba3ed2463809493f76d8e5d6c6d245de8b0560438c13450e" dependencies = [ "bstr", "dunce", @@ -1142,7 +1142,7 @@ dependencies = [ "itoa", "smallvec", "thiserror", - "winnow 0.6.15", + "winnow 0.6.16", ] [[package]] @@ -1265,7 +1265,7 @@ dependencies = [ "gix-utils", "maybe-async", "thiserror", - "winnow 0.6.15", + "winnow 0.6.16", ] [[package]] @@ -1281,12 +1281,11 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.44.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3394a2997e5bc6b22ebc1e1a87b41eeefbcfcff3dbfa7c4bd73cb0ac8f1f3e2e" +checksum = "636e96a0a5562715153fee098c217110c33a6f8218f08f4687ff99afde159bb5" dependencies = [ "gix-actor", - "gix-date", "gix-features", "gix-fs", "gix-hash", @@ -1298,7 +1297,7 @@ dependencies = [ "gix-validate", "memmap2", "thiserror", - "winnow 0.6.15", + "winnow 0.6.16", ] [[package]] @@ -1358,9 +1357,9 @@ dependencies = [ [[package]] name = "gix-submodule" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921cd49924ac14b6611b22e5fb7bbba74d8780dc7ad26153304b64d1272460ac" +checksum = "0f2e0f69aa00805e39d39ec80472a7e9da20ed5d73318b27925a2cc198e854fd" dependencies = [ "bstr", "gix-config", @@ -1725,9 +1724,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" @@ -1769,9 +1768,9 @@ dependencies = [ [[package]] name = "kstring" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e703acfd696000db3f6d1238e23b3d1f889192e1e439969c44e8423bb7a5655e" +checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" dependencies = [ "static_assertions", ] @@ -2509,9 +2508,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -2705,9 +2704,9 @@ dependencies = [ [[package]] name = "tame-index" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf60b994ded7946fbf1c3eea9aff178da624dfb101b14c7341db018ddaf483e" +checksum = "1f0f4d65983026107eded665823d7088056c3d9d7f5f8cd9071afcd3749dc2fe" dependencies = [ "bytes", "camino", @@ -2895,9 +2894,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" dependencies = [ "serde", ] @@ -3349,9 +3348,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.15" +version = "0.6.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" +checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 0b5545c0e..20019efaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,7 @@ spdx = "0.10" # Lazy strum = { version = "0.26", features = ["derive"] } # Index retrieval and querying -tame-index = { version = "0.12", default-features = false, features = [ +tame-index = { version = "0.13", default-features = false, features = [ "git", "local", "sparse", @@ -125,7 +125,7 @@ walkdir = "2.3" # We clone/fetch advisory databases [dependencies.gix] -version = "0.63" +version = "0.64" default-features = false features = [ "blocking-http-transport-reqwest", @@ -139,7 +139,7 @@ features = [ fs_extra = "1.3" # Snapshot testing insta = { version = "1.21", features = ["json"] } -tame-index = { version = "0.12", features = ["local-builder"] } +tame-index = { version = "0.13", features = ["local-builder"] } time = { version = "0.3", features = ["serde"] } toml-span = { version = "0.3", features = ["serde"] } # We use this for creating fake crate directories for crawling license files on disk diff --git a/docs/src/checks/advisories/diags.md b/docs/src/checks/advisories/diags.md index 924a46981..16fb0a899 100644 --- a/docs/src/checks/advisories/diags.md +++ b/docs/src/checks/advisories/diags.md @@ -1,5 +1,6 @@ # Advisories Diagnostics + ### `vulnerability` A [`vulnerability`](cfg.md#the-vulnerability-field-optional) advisory was detected for a crate. diff --git a/docs/src/checks/bans/cfg.md b/docs/src/checks/bans/cfg.md index 3b60ec71a..6e43270bf 100644 --- a/docs/src/checks/bans/cfg.md +++ b/docs/src/checks/bans/cfg.md @@ -38,6 +38,22 @@ If specified, alters how the `wildcard` field behaves: Being limited to private crates is due to crates.io not allowing packages to be published with `path` or `git` dependencies except for `dev-dependencies`. +### The `workspace-duplicates` field (optional) + +Determines what happens when a more than 1 direct workspace dependency is resolved to the same crate and 1 or more declarations do not use `workspace = true` + +* `deny` - Will emit an error for each dependency declaration that does not use `workspace = true` +* `warn` (default) - Will emit a warning for each dependency declaration that does not use `workspace = true`, but does not fail the check. +* `allow` - Ignores checking for `workspace = true` + +### The `unused-workspace-dependencies` field (optional) + +Determines what happens when a dependency in [`[workspace.dependencies]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table) is not used in the workspace. + +* `deny` - Will emit an error for each dependency that is not actually used in the workspace. +* `warn` - Will emit a warning for each dependency that is not actually used in the workspace, but does not fail the check. +* `allow` - (default) Ignores checking for unused workspace dependencies. + ### The `highlight` field (optional) When multiple versions of the same crate are encountered and `multiple-versions` is set to `warn` or `deny`, using the `-g ` option will print out a [dotgraph](https://www.graphviz.org/) of each of the versions and how they were included into the graph. This field determines how the graph is colored to help you quickly spot good candidates for removal or updating. diff --git a/docs/src/checks/bans/diags.md b/docs/src/checks/bans/diags.md index 5b1be2c1e..37876ae38 100644 --- a/docs/src/checks/bans/diags.md +++ b/docs/src/checks/bans/diags.md @@ -1,5 +1,6 @@ # Bans diagnostics + ### `banned` A crate which is [explicitly banned](cfg.md#the-allow-and-deny-fields-optional) was detected. @@ -24,6 +25,18 @@ A crate version that matched an entry in [`bans.skip`](cfg.md#the-skip-field-opt A crate was included via a [wildcard dependency](cfg.md#the-wildcards-field-optional) by one or more crates. +### `workspace-duplicate` + +A direct workspace dependency was referred to more than once and all declarations did not use [`workspace = true`](cfg.md#the-workspace-duplicates-field-optional) + +### `unresolved-workspace-dependency` + +We were unable to determine the exact crate a workspace dependency (or patch) was resolved to. This most likely indicates a bug in cargo-deny. + +### `unused-workspace-dependency` + +A [`[workspace.dependencies]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table) was declared, but not actually used anywhere in the workspace. + ### `unmatched-skip` A crate version in [`bans.skip`](cfg.md#the-skip-field-optional) was not encountered. diff --git a/docs/src/checks/licenses/diags.md b/docs/src/checks/licenses/diags.md index 767c76b3b..2b60e2842 100644 --- a/docs/src/checks/licenses/diags.md +++ b/docs/src/checks/licenses/diags.md @@ -1,5 +1,6 @@ # Licenses Diagnostics + ### `rejected` One or more licenses for a crate were rejected because they were not configured to be [allowed](cfg.md#the-allow-and-deny-fields-optional). diff --git a/docs/src/checks/sources/diags.md b/docs/src/checks/sources/diags.md index b9e212e02..24f8b04ac 100644 --- a/docs/src/checks/sources/diags.md +++ b/docs/src/checks/sources/diags.md @@ -1,5 +1,6 @@ # Sources diagnostics + ### `git-source-underspecified` A `git` source uses a specification that doesn't meet the minimum specifier required by [`sources.required-git-spec`](cfg.md#the-required-git-spec-optional). diff --git a/src/advisories/helpers/db.rs b/src/advisories/helpers/db.rs index b6cf5e764..d8c1dc170 100644 --- a/src/advisories/helpers/db.rs +++ b/src/advisories/helpers/db.rs @@ -227,12 +227,12 @@ fn fetch_and_checkout(repo: &mut gix::Repository) -> anyhow::Result<()> { { let mut config = repo.config_snapshot_mut(); config - .set_raw_value("committer", None, "name", "cargo-deny") + .set_raw_value(&"committer.name", "cargo-deny") .context("failed to set `committer.name`")?; // Note we _have_ to set the email as well, but luckily gix does not actually // validate if it's a proper email or not :) config - .set_raw_value("committer", None, "email", "") + .set_raw_value(&"committer.email", "") .context("failed to set `committer.email`")?; let repo = config diff --git a/src/bans.rs b/src/bans.rs index 6abb385a9..9d0956620 100644 --- a/src/bans.rs +++ b/src/bans.rs @@ -1644,6 +1644,7 @@ fn check_workspace_duplicates( // there are situations where the user wants to explicitly opt out // of the lint for a specific crate/crates/manifest they need to use // [package.metadata.cargo-deny.workspace-duplicates] + // TODO: ...actually support this https://github.com/EmbarkStudios/cargo-deny/issues/677 if mdep.workspace.is_some() { continue; } diff --git a/src/cargo-deny/common.rs b/src/cargo-deny/common.rs index 3f6a58ca7..379940355 100644 --- a/src/cargo-deny/common.rs +++ b/src/cargo-deny/common.rs @@ -203,7 +203,6 @@ impl KrateContext { Ok(graph?) } - #[cfg(not(feature = "standalone"))] fn get_metadata(opts: MetadataOptions) -> Result { let mut mdc = krates::Cmd::new(); @@ -226,61 +225,6 @@ impl KrateContext { let mdc: krates::cm::MetadataCommand = mdc.into(); Ok(mdc.exec()?) } - - #[cfg(feature = "standalone")] - fn get_metadata(opts: MetadataOptions) -> Result { - use anyhow::Context as _; - use cargo::{core, ops, util}; - - let mut config = util::Config::default()?; - - config.configure( - 0, - true, - None, - opts.frozen, - opts.locked, - opts.offline, - &None, - &[], - &[], - )?; - - let mut manifest_path = opts.manifest_path; - - // Cargo doesn't like non-absolute paths - if !manifest_path.is_absolute() { - manifest_path = cargo_deny::utf8path( - std::env::current_dir() - .context("unable to determine current directory")? - .join(manifest_path), - )?; - } - - let features = std::rc::Rc::new( - opts.features - .into_iter() - .map(|feat| core::FeatureValue::new(util::interning::InternedString::new(&feat))) - .collect(), - ); - - let ws = core::Workspace::new(manifest_path.as_std_path(), &config)?; - let options = ops::OutputMetadataOptions { - cli_features: core::resolver::features::CliFeatures { - features, - all_features: opts.all_features, - uses_default_features: !opts.no_default_features, - }, - no_deps: false, - version: 1, - filter_platforms: vec![], - }; - - let md = ops::output_metadata(&ws, &options)?; - let md_value = serde_json::to_value(md)?; - - Ok(serde_json::from_value(md_value)?) - } } struct MetadataOptions { @@ -293,7 +237,6 @@ struct MetadataOptions { offline: bool, } -#[cfg(not(feature = "standalone"))] fn fetch(opts: MetadataOptions) -> anyhow::Result<()> { use anyhow::Context as _; let mut cargo = @@ -323,45 +266,6 @@ fn fetch(opts: MetadataOptions) -> anyhow::Result<()> { } } -#[cfg(feature = "standalone")] -fn fetch(opts: MetadataOptions) -> anyhow::Result<()> { - use anyhow::Context; - use cargo::{core, ops, util}; - - let mut config = util::Config::default()?; - - config.configure( - 0, - true, - None, - opts.frozen, - opts.locked, - opts.offline, - &None, - &[], - &[], - )?; - - let mut manifest_path = opts.manifest_path; - - // Cargo doesn't like non-absolute paths - if !manifest_path.is_absolute() { - manifest_path = cargo_deny::utf8path( - std::env::current_dir() - .context("unable to determine current directory")? - .join(manifest_path), - )?; - } - - let ws = core::Workspace::new(manifest_path.as_std_path(), &config)?; - let options = ops::FetchOptions { - config: &config, - targets: Vec::new(), - }; - ops::fetch(&ws, &options)?; - Ok(()) -} - #[inline] pub fn log_level_to_severity(log_level: log::LevelFilter) -> Option { match log_level { diff --git a/tests/feature_bans.rs b/tests/feature_bans.rs index 0fe273ea1..9c9563446 100644 --- a/tests/feature_bans.rs +++ b/tests/feature_bans.rs @@ -1,4 +1,5 @@ -#![cfg(no)] +#![cfg(any())] + use cargo_deny::{func_name, test_utils::*}; /// Ensures that you can ban features in your own workspace. `simple` is brought diff --git a/tests/test_data/workspace/crates/member-two/src/lib.rs b/tests/test_data/workspace/crates/member-two/src/lib.rs index 7d12d9af8..8b1378917 100644 --- a/tests/test_data/workspace/crates/member-two/src/lib.rs +++ b/tests/test_data/workspace/crates/member-two/src/lib.rs @@ -1,14 +1 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -}