diff --git a/bevy_lint/src/lints/borrow_of_reborrowable.rs b/bevy_lint/src/lints/borrowed_reborrowable.rs similarity index 92% rename from bevy_lint/src/lints/borrow_of_reborrowable.rs rename to bevy_lint/src/lints/borrowed_reborrowable.rs index 1049e6e..1ba2cd3 100644 --- a/bevy_lint/src/lints/borrow_of_reborrowable.rs +++ b/bevy_lint/src/lints/borrowed_reborrowable.rs @@ -55,28 +55,28 @@ use rustc_session::declare_lint_pass; use rustc_span::{def_id::LocalDefId, symbol::Ident, Span}; declare_bevy_lint! { - pub BORROW_OF_COMMANDS, + pub BORROWED_COMMANDS, PEDANTIC, "parameter takes a mutable reference to `Commands` or `EntityCommands` instead of a re-borrowed instance", } declare_bevy_lint! { - pub BORROW_OF_RESOURCE, + pub BORROWED_RESOURCE, PEDANTIC, "parameter takes a mutable reference to `ResMut` or `NonSendMut` instead of a re-borrowed instance", } declare_bevy_lint! { - pub BORROW_OF_QUERY, + pub BORROWED_QUERY, PEDANTIC, "parameter takes a mutable reference to `Query` instead of a re-borrowed instance", } declare_lint_pass! { - BorrowOfReborrowable => [BORROW_OF_COMMANDS.lint, BORROW_OF_RESOURCE.lint, BORROW_OF_QUERY.lint] + BorrowedReborrowable => [BORROWED_COMMANDS.lint, BORROWED_RESOURCE.lint, BORROWED_QUERY.lint] } -impl<'tcx> LateLintPass<'tcx> for BorrowOfReborrowable { +impl<'tcx> LateLintPass<'tcx> for BorrowedReborrowable { fn check_fn( &mut self, cx: &LateContext<'tcx>, @@ -186,11 +186,11 @@ impl Reborrowable { fn lint(&self) -> &'static Lint { match self { - Self::Commands => BORROW_OF_COMMANDS.lint, - Self::EntityCommands => BORROW_OF_COMMANDS.lint, - Self::Query => BORROW_OF_QUERY.lint, - Self::ResMut => BORROW_OF_RESOURCE.lint, - Self::NonSendMut => BORROW_OF_RESOURCE.lint, + Self::Commands => BORROWED_COMMANDS.lint, + Self::EntityCommands => BORROWED_COMMANDS.lint, + Self::Query => BORROWED_QUERY.lint, + Self::ResMut => BORROWED_RESOURCE.lint, + Self::NonSendMut => BORROWED_RESOURCE.lint, } } diff --git a/bevy_lint/src/lints/mod.rs b/bevy_lint/src/lints/mod.rs index 73db6e5..1f7c3c0 100644 --- a/bevy_lint/src/lints/mod.rs +++ b/bevy_lint/src/lints/mod.rs @@ -5,7 +5,7 @@ use crate::lint::BevyLint; use rustc_lint::{Lint, LintStore}; -pub mod borrow_of_reborrowable; +pub mod borrowed_reborrowable; pub mod insert_event_resource; pub mod main_return_without_appexit; pub mod missing_reflect; @@ -13,9 +13,9 @@ pub mod panicking_methods; pub mod plugin_not_ending_in_plugin; pub(crate) static LINTS: &[&BevyLint] = &[ - borrow_of_reborrowable::BORROW_OF_COMMANDS, - borrow_of_reborrowable::BORROW_OF_RESOURCE, - borrow_of_reborrowable::BORROW_OF_QUERY, + borrowed_reborrowable::BORROWED_COMMANDS, + borrowed_reborrowable::BORROWED_RESOURCE, + borrowed_reborrowable::BORROWED_QUERY, insert_event_resource::INSERT_EVENT_RESOURCE, main_return_without_appexit::MAIN_RETURN_WITHOUT_APPEXIT, panicking_methods::PANICKING_QUERY_METHODS, @@ -30,7 +30,7 @@ pub(crate) fn register_lints(store: &mut LintStore) { } pub(crate) fn register_passes(store: &mut LintStore) { - store.register_late_pass(|_| Box::new(borrow_of_reborrowable::BorrowOfReborrowable)); + store.register_late_pass(|_| Box::new(borrowed_reborrowable::BorrowedReborrowable)); store.register_late_pass(|_| Box::new(insert_event_resource::InsertEventResource)); store.register_late_pass(|_| Box::new(main_return_without_appexit::MainReturnWithoutAppExit)); store.register_late_pass(|_| Box::new(missing_reflect::MissingReflect)); diff --git a/bevy_lint/tests/ui/borrow_of_reborrowable/commands.rs b/bevy_lint/tests/ui/borrowed_reborrowable/commands.rs similarity index 90% rename from bevy_lint/tests/ui/borrow_of_reborrowable/commands.rs rename to bevy_lint/tests/ui/borrowed_reborrowable/commands.rs index 239e095..b1b2ed1 100644 --- a/bevy_lint/tests/ui/borrow_of_reborrowable/commands.rs +++ b/bevy_lint/tests/ui/borrowed_reborrowable/commands.rs @@ -1,8 +1,8 @@ -//! This tests the `borrow_of_reborrowable` lint, specifically when triggered on the `Commands` type. +//! This tests the `borrowed_reborrowable` lint, specifically when triggered on the `Commands` type. #![feature(register_tool)] #![register_tool(bevy)] -#![deny(bevy::borrow_of_commands)] + #![deny(bevy::borrowed_commands)] use bevy::ecs::system::EntityCommands; use bevy::prelude::*; diff --git a/bevy_lint/tests/ui/borrow_of_reborrowable/commands.stderr b/bevy_lint/tests/ui/borrowed_reborrowable/commands.stderr similarity index 77% rename from bevy_lint/tests/ui/borrow_of_reborrowable/commands.stderr rename to bevy_lint/tests/ui/borrowed_reborrowable/commands.stderr index fb46d75..264b73c 100644 --- a/bevy_lint/tests/ui/borrow_of_reborrowable/commands.stderr +++ b/bevy_lint/tests/ui/borrowed_reborrowable/commands.stderr @@ -1,17 +1,17 @@ error: parameter takes `&mut Commands` instead of a re-borrowed `Commands` - --> tests/ui/borrow_of_reborrowable/commands.rs:17:22 + --> tests/ui/borrowed_reborrowable/commands.rs:17:22 | 17 | fn mutable_reference(commands: &mut Commands) { | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `Commands` instead: `mut commands: bevy::prelude::Commands<'_, '_>` | note: the lint level is defined here - --> tests/ui/borrow_of_reborrowable/commands.rs:5:9 + --> tests/ui/borrowed_reborrowable/commands.rs:5:9 | -5 | #![deny(bevy::borrow_of_commands)] +5 | #![deny(bevy::borrowed_commands)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: parameter takes `&mut Commands` instead of a re-borrowed `Commands` - --> tests/ui/borrow_of_reborrowable/commands.rs:23:33 + --> tests/ui/borrowed_reborrowable/commands.rs:23:33 | 23 | fn mutable_reference_return<'a>(_commands: &'a mut Commands) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `Commands` instead: `mut _commands: bevy::prelude::Commands<'_, '_>` diff --git a/bevy_lint/tests/ui/borrow_of_reborrowable/query.rs b/bevy_lint/tests/ui/borrowed_reborrowable/query.rs similarity index 91% rename from bevy_lint/tests/ui/borrow_of_reborrowable/query.rs rename to bevy_lint/tests/ui/borrowed_reborrowable/query.rs index 01cd5c1..eef059c 100644 --- a/bevy_lint/tests/ui/borrow_of_reborrowable/query.rs +++ b/bevy_lint/tests/ui/borrowed_reborrowable/query.rs @@ -1,8 +1,8 @@ -//! This tests the `borrow_of_reborrowable` lint, specifically when triggered on the `Query` type. +//! This tests the `borrowed_reborrowable` lint, specifically when triggered on the `Query` type. #![feature(register_tool)] #![register_tool(bevy)] -#![deny(bevy::borrow_of_query)] +#![deny(bevy::borrowed_query)] use bevy::ecs::system::QueryLens; use bevy::prelude::*; diff --git a/bevy_lint/tests/ui/borrow_of_reborrowable/query.stderr b/bevy_lint/tests/ui/borrowed_reborrowable/query.stderr similarity index 78% rename from bevy_lint/tests/ui/borrow_of_reborrowable/query.stderr rename to bevy_lint/tests/ui/borrowed_reborrowable/query.stderr index 75697b3..efda010 100644 --- a/bevy_lint/tests/ui/borrow_of_reborrowable/query.stderr +++ b/bevy_lint/tests/ui/borrowed_reborrowable/query.stderr @@ -1,17 +1,17 @@ error: parameter takes `&mut Query` instead of a re-borrowed `Query` - --> tests/ui/borrow_of_reborrowable/query.rs:17:22 + --> tests/ui/borrowed_reborrowable/query.rs:17:22 | 17 | fn mutable_reference(query: &mut Query) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `Query` instead: `mut query: bevy::prelude::Query<'_, '_, bevy::prelude::Entity>` | note: the lint level is defined here - --> tests/ui/borrow_of_reborrowable/query.rs:5:9 + --> tests/ui/borrowed_reborrowable/query.rs:5:9 | -5 | #![deny(bevy::borrow_of_query)] +5 | #![deny(bevy::borrowed_query)] | ^^^^^^^^^^^^^^^^^^^^^ error: parameter takes `&mut Query` instead of a re-borrowed `Query` - --> tests/ui/borrow_of_reborrowable/query.rs:23:33 + --> tests/ui/borrowed_reborrowable/query.rs:23:33 | 23 | fn mutable_reference_return<'a>(_query: &'a mut Query) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `Query` instead: `mut _query: bevy::prelude::Query<'_, '_, bevy::prelude::Entity>` diff --git a/bevy_lint/tests/ui/borrow_of_reborrowable/resource.rs b/bevy_lint/tests/ui/borrowed_reborrowable/resource.rs similarity index 90% rename from bevy_lint/tests/ui/borrow_of_reborrowable/resource.rs rename to bevy_lint/tests/ui/borrowed_reborrowable/resource.rs index 835ca00..8796c13 100644 --- a/bevy_lint/tests/ui/borrow_of_reborrowable/resource.rs +++ b/bevy_lint/tests/ui/borrowed_reborrowable/resource.rs @@ -1,8 +1,8 @@ -//! This tests the `borrow_of_reborrowable` lint, specifically when triggered on the `ResMut` type. +//! This tests the `borrowed_reborrowable` lint, specifically when triggered on the `ResMut` type. #![feature(register_tool)] #![register_tool(bevy)] -#![deny(bevy::borrow_of_resource)] +#![deny(bevy::borrowed_resource)] use bevy::prelude::*; diff --git a/bevy_lint/tests/ui/borrow_of_reborrowable/resource.stderr b/bevy_lint/tests/ui/borrowed_reborrowable/resource.stderr similarity index 76% rename from bevy_lint/tests/ui/borrow_of_reborrowable/resource.stderr rename to bevy_lint/tests/ui/borrowed_reborrowable/resource.stderr index 2c58822..7c87e6c 100644 --- a/bevy_lint/tests/ui/borrow_of_reborrowable/resource.stderr +++ b/bevy_lint/tests/ui/borrowed_reborrowable/resource.stderr @@ -1,17 +1,17 @@ error: parameter takes `&mut ResMut` instead of a re-borrowed `ResMut` - --> tests/ui/borrow_of_reborrowable/resource.rs:19:22 + --> tests/ui/borrowed_reborrowable/resource.rs:19:22 | 19 | fn mutable_reference(_res: &mut ResMut) { | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `ResMut` instead: `mut _res: bevy::prelude::ResMut<'_, Data>` | note: the lint level is defined here - --> tests/ui/borrow_of_reborrowable/resource.rs:5:9 + --> tests/ui/borrowed_reborrowable/resource.rs:5:9 | -5 | #![deny(bevy::borrow_of_resource)] +5 | #![deny(bevy::borrowed_resource)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: parameter takes `&mut ResMut` instead of a re-borrowed `ResMut` - --> tests/ui/borrow_of_reborrowable/resource.rs:25:33 + --> tests/ui/borrowed_reborrowable/resource.rs:25:33 | 25 | fn mutable_reference_return<'a>(_res: &'a mut ResMut) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `ResMut` instead: `mut _res: bevy::prelude::ResMut<'_, Data>`