RS.CLIPPY.UNUSED_SELF
Methods that contain a `self` argument but don't use it
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: unused_self. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks methods that contain a self argument but don't use it
Why is this bad?
It may be clearer to define the method as an associated function instead
of an instance method if it doesn't require self.
Example
struct A;
impl A {
fn method(&self) {}
}
Could be written:
struct A;
impl A {
fn method() {}
}
Configuration
-
avoid-breaking-exported-api: Suppress lints whenever the suggested change would cause breakage for other crates.(default:
true)