Skip to contentSlop Block

require-impl-method-order

Hint

In an inherent impl, put new first and public methods before private ones.

impl AuthenticationGuard {	pub fn related(role: Role) -> Self {		return Self { role };	}	pub fn new() -> Self {Order the methods of this impl: new first, then public methods, then private ones		return Self;	}}
impl AuthenticationGuard {	fn verify(&self) {}	pub fn related(role: Role) -> Self {Order the methods of this impl: new first, then public methods, then private ones		return Self { role };	}}
// ast-grep-ignore: require-impl-method-order-rust

How to fix

In an inherent impl block, new is the first method and every pub method comes before the private ones. The rule skips trait impls because their methods have no visibility.