Skip to content

Parameters and `self`

Every parameter must be used. One that is kept on purpose (a callback signature, a trait method that ignores an argument) is marked in its definition: fn on_click(unused event: Event), fn(unused x) => 1. A parameter marked unused that is used anyway is also an error.

A method that takes self must use it. A type’s own method that does not is an error: it should be a static function (Type.f(...)) instead. Only trait methods may write unused &self, because the trait fixes the signature.