From 645ae9dc387654860d47cd7cb84d3bbb7549dfa8 Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Thu, 13 Mar 2025 11:12:49 -0400 Subject: [PATCH 1/7] feat: update changelog --- bevy_lint/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bevy_lint/CHANGELOG.md b/bevy_lint/CHANGELOG.md index b9947ecd..44f0e26e 100644 --- a/bevy_lint/CHANGELOG.md +++ b/bevy_lint/CHANGELOG.md @@ -7,9 +7,9 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic [Keep a Changelog]: https://keepachangelog.com/en/1.1.0/ [Semantic Versioning]: https://semver.org/spec/v2.0.0.html -## [Unreleased] +## [v0.2.0] - 2025-03-13 -**All Changes**: [`lint-v0.1.0...main`](https://github.com/TheBevyFlock/bevy_cli/compare/lint-v0.1.0...main) +**All Changes**: [`lint-v0.1.0...lint-v0.2.0`](https://github.com/TheBevyFlock/bevy_cli/compare/lint-v0.1.0...lint-v0.2.0) ### Added From 32377ed5ff5fb2d4bfe0118b0fd7299b42ae7fe6 Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Thu, 13 Mar 2025 11:13:13 -0400 Subject: [PATCH 2/7] feat!: remove `-dev` suffix --- Cargo.lock | 2 +- bevy_lint/Cargo.toml | 2 +- bevy_lint/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e72f2fd3..cb67debf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -474,7 +474,7 @@ dependencies = [ [[package]] name = "bevy_lint" -version = "0.2.0-dev" +version = "0.2.0" dependencies = [ "anyhow", "bevy", diff --git a/bevy_lint/Cargo.toml b/bevy_lint/Cargo.toml index a34dff75..5fc7eb7e 100644 --- a/bevy_lint/Cargo.toml +++ b/bevy_lint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_lint" -version = "0.2.0-dev" +version = "0.2.0" authors = ["BD103"] edition = "2024" description = "A collection of lints for the Bevy game engine" diff --git a/bevy_lint/README.md b/bevy_lint/README.md index ea2a29a7..9e3cf267 100644 --- a/bevy_lint/README.md +++ b/bevy_lint/README.md @@ -176,7 +176,7 @@ There are several other ways to toggle lints, although some have varying levels |`bevy_lint` Version|Rust Version|Rustup Toolchain|Bevy Version| |-|-|-|-| -|0.2.0-dev|1.84.0|`nightly-2025-02-20`|0.15| +|0.2.0|1.84.0|`nightly-2025-02-20`|0.15| |0.1.0|1.84.0|`nightly-2024-11-14`|0.14| The Rust version in the above table specifies what [version of the Rust language](https://github.com/rust-lang/rust/releases) can be compiled with `bevy_lint`. Code written for a later version of Rust may not compile. (This is not usually an issue, though, because `bevy_lint`'s Rust version is kept 1 to 2 releases ahead of stable Rust.) From fc5010fd660b029951afee23200e9a6d07ec1a1c Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Tue, 18 Mar 2025 13:55:50 -0400 Subject: [PATCH 3/7] refactor: flatten `cargo` module Make `duplicate_bevy_dependencies` appear to be "just another lint", and make `cargo` private. --- bevy_lint/src/lints/{cargo/mod.rs => cargo.rs} | 6 ++---- .../src/lints/{cargo => }/duplicate_bevy_dependencies.rs | 0 bevy_lint/src/lints/mod.rs | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename bevy_lint/src/lints/{cargo/mod.rs => cargo.rs} (89%) rename bevy_lint/src/lints/{cargo => }/duplicate_bevy_dependencies.rs (100%) diff --git a/bevy_lint/src/lints/cargo/mod.rs b/bevy_lint/src/lints/cargo.rs similarity index 89% rename from bevy_lint/src/lints/cargo/mod.rs rename to bevy_lint/src/lints/cargo.rs index e9becc11..8e3654ae 100644 --- a/bevy_lint/src/lints/cargo/mod.rs +++ b/bevy_lint/src/lints/cargo.rs @@ -1,15 +1,13 @@ //! Lints that check over `Cargo.toml` instead of your code. +use super::duplicate_bevy_dependencies::DUPLICATE_BEVY_DEPENDENCIES; use crate::declare_bevy_lint_pass; use cargo_metadata::MetadataCommand; use clippy_utils::sym; -use duplicate_bevy_dependencies::DUPLICATE_BEVY_DEPENDENCIES; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{config::Input, utils::was_invoked_from_cargo}; use rustc_span::Symbol; -pub mod duplicate_bevy_dependencies; - declare_bevy_lint_pass! { pub Cargo => [DUPLICATE_BEVY_DEPENDENCIES.lint], @default = { @@ -37,7 +35,7 @@ impl LateLintPass<'_> for Cargo { .exec() { Ok(metadata) => { - duplicate_bevy_dependencies::check(cx, &metadata, self.bevy); + super::duplicate_bevy_dependencies::check(cx, &metadata, self.bevy); } Err(e) => { cx.tcx diff --git a/bevy_lint/src/lints/cargo/duplicate_bevy_dependencies.rs b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs similarity index 100% rename from bevy_lint/src/lints/cargo/duplicate_bevy_dependencies.rs rename to bevy_lint/src/lints/duplicate_bevy_dependencies.rs diff --git a/bevy_lint/src/lints/mod.rs b/bevy_lint/src/lints/mod.rs index ea5d591b..f9b783ef 100644 --- a/bevy_lint/src/lints/mod.rs +++ b/bevy_lint/src/lints/mod.rs @@ -7,8 +7,10 @@ use crate::lint::BevyLint; use rustc_lint::{Lint, LintStore}; +mod cargo; + pub mod borrowed_reborrowable; -pub mod cargo; +pub mod duplicate_bevy_dependencies; pub mod insert_event_resource; pub mod insert_unit_bundle; pub mod main_return_without_appexit; @@ -19,7 +21,7 @@ pub mod zst_query; pub(crate) static LINTS: &[&BevyLint] = &[ borrowed_reborrowable::BORROWED_REBORROWABLE, - cargo::duplicate_bevy_dependencies::DUPLICATE_BEVY_DEPENDENCIES, + duplicate_bevy_dependencies::DUPLICATE_BEVY_DEPENDENCIES, insert_event_resource::INSERT_EVENT_RESOURCE, insert_unit_bundle::INSERT_UNIT_BUNDLE, main_return_without_appexit::MAIN_RETURN_WITHOUT_APPEXIT, From 35e83a7699f7be8bc73cebd62af2a9eb45bc51df Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:20:08 -0400 Subject: [PATCH 4/7] feat: make `duplicate_bevy_dependencies` crate-only --- bevy_lint/src/lints/duplicate_bevy_dependencies.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/bevy_lint/src/lints/duplicate_bevy_dependencies.rs b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs index e87057c6..52562027 100644 --- a/bevy_lint/src/lints/duplicate_bevy_dependencies.rs +++ b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs @@ -78,6 +78,7 @@ declare_bevy_lint! { pub DUPLICATE_BEVY_DEPENDENCIES, NURSERY, "multiple versions of the `bevy` crate found", + @crate_level_only = true, } #[derive(Deserialize, Debug)] From 4e6da184ed4f72f436c52822bda56f9727b9eb7f Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:21:07 -0400 Subject: [PATCH 5/7] feat: improve docs for `duplicate_bevy_dependencies` --- .../src/lints/duplicate_bevy_dependencies.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bevy_lint/src/lints/duplicate_bevy_dependencies.rs b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs index 52562027..d058eb84 100644 --- a/bevy_lint/src/lints/duplicate_bevy_dependencies.rs +++ b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs @@ -1,11 +1,20 @@ //! Checks for multiple versions of the `bevy` crate in your project's dependencies. //! +//! This lint will prevent you from accidentally using multiple versions of the Bevy game engine at +//! the same time by scanning your dependency tree for the `bevy` crate. If your project or its +//! dependencies use different versions of `bevy`, this lint will emit a warning. +//! +//! You may also be interested in [`cargo-deny`], which can detect duplicate dependencies as well, +//! and is far more powerful and configurable. +//! +//! [`cargo-deny`]: https://github.com/EmbarkStudios/cargo-deny +//! //! # Motivation //! //! Cargo allows there to be multiple major versions of a crate in your project's dependency -//! tree[^semver-compatibility]. Though the two crates and their types are _named_ the same, they -//! are treated as distinct by the compiler. This can lead to confusing error messages that only -//! appear if you try to mix the types from the two versions of the crate. +//! tree[^semver-compatibility]. Although the crates and their types are _named_ the same, they are +//! treated as distinct by the compiler. This can lead to confusing error messages that only appear +//! if you try to mix the types from the two versions of the crate. //! //! With Bevy, these errors become particularly easy to encounter when you add a plugin that pulls //! in a different version of the Bevy engine. (This isn't immediately obvious, however, unless you From 11bdf3550504da885f0ffbe187ce63bcafecd709 Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Wed, 19 Mar 2025 11:05:06 -0400 Subject: [PATCH 6/7] refactor: rustfmt --- bevy_lint/src/lints/duplicate_bevy_dependencies.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bevy_lint/src/lints/duplicate_bevy_dependencies.rs b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs index d058eb84..7a6a157c 100644 --- a/bevy_lint/src/lints/duplicate_bevy_dependencies.rs +++ b/bevy_lint/src/lints/duplicate_bevy_dependencies.rs @@ -3,7 +3,7 @@ //! This lint will prevent you from accidentally using multiple versions of the Bevy game engine at //! the same time by scanning your dependency tree for the `bevy` crate. If your project or its //! dependencies use different versions of `bevy`, this lint will emit a warning. -//! +//! //! You may also be interested in [`cargo-deny`], which can detect duplicate dependencies as well, //! and is far more powerful and configurable. //! From 5e99f1dd6a9874e7da6dcae173d1efd3fd8cadbc Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Wed, 19 Mar 2025 11:06:45 -0400 Subject: [PATCH 7/7] fix: update release date --- bevy_lint/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bevy_lint/CHANGELOG.md b/bevy_lint/CHANGELOG.md index 44f0e26e..ee300e79 100644 --- a/bevy_lint/CHANGELOG.md +++ b/bevy_lint/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic [Keep a Changelog]: https://keepachangelog.com/en/1.1.0/ [Semantic Versioning]: https://semver.org/spec/v2.0.0.html -## [v0.2.0] - 2025-03-13 +## [v0.2.0] - 2025-03-19 **All Changes**: [`lint-v0.1.0...lint-v0.2.0`](https://github.com/TheBevyFlock/bevy_cli/compare/lint-v0.1.0...lint-v0.2.0)