You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change bevy_reflect::RegisterForReflection::__register() to expect unused variables, rather than putting underscores on the parameter names (bevyengine#17171)
# Objective
While checking over bevyengine#17160, it
occurred to me that rust-analyzer will copy the method signature
exactly, when using tab completion trait methods. This includes provided
trait methods that use underscores to silence the `unused_variables`
lint. This probably isn't good for users, seeing as how they'll have to
remove the underscore if they want to use the parameters.
(I mean, they technically don't have to remove the underscore... but
usually you don't keep a leading underscore on parameters you're using.)
## Solution
Changes `bevy_reflect::RegisterForReflection::__register()` to
`#[expect(unused_variables)]`, and removes the underscores from its
parameter names.
## Testing
N/A
Copy file name to clipboardExpand all lines: crates/bevy_reflect/src/lib.rs
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -691,7 +691,11 @@ pub mod __macro_exports {
691
691
note = "consider annotating `{Self}` with `#[derive(Reflect)]`"
692
692
)]
693
693
pubtraitRegisterForReflection{
694
-
fn__register(_registry:&mutTypeRegistry){}
694
+
#[expect(
695
+
unused_variables,
696
+
reason = "The parameters here are intentionally unused by the default implementation; however, putting underscores here will result in the underscores being copied by rust-analyzer's tab completion."
0 commit comments