mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
cc622608db
`must_use_unit` lints unit-returning functions with a `#[must_use]` attribute, suggesting to remove it. `double_must_use` lints functions with a plain `#[must_use]` attribute, but which return a type which is already `#[must_use]`, so the attribute has no benefit. `must_use_candidate` is a pedantic lint that lints functions and methods that return some non-unit type that is not already `#[must_use]` and suggests to add the annotation.
40 lines
1.7 KiB
Text
40 lines
1.7 KiB
Text
error: this function could have a `#[must_use]` attribute
|
|
--> $DIR/must_use_candidates.rs:12:1
|
|
|
|
|
LL | pub fn pure(i: u8) -> u8 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pure(i: u8) -> u8`
|
|
|
|
|
= note: `-D clippy::must-use-candidate` implied by `-D warnings`
|
|
|
|
error: this method could have a `#[must_use]` attribute
|
|
--> $DIR/must_use_candidates.rs:17:5
|
|
|
|
|
LL | pub fn inherent_pure(&self) -> u8 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn inherent_pure(&self) -> u8`
|
|
|
|
error: this method could have a `#[must_use]` attribute
|
|
--> $DIR/must_use_candidates.rs:31:5
|
|
|
|
|
LL | fn trait_impl_pure(&self, i: u32) -> u32 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] fn trait_impl_pure(&self, i: u32) -> u32`
|
|
|
|
error: this function could have a `#[must_use]` attribute
|
|
--> $DIR/must_use_candidates.rs:48:1
|
|
|
|
|
LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool`
|
|
|
|
error: this function could have a `#[must_use]` attribute
|
|
--> $DIR/must_use_candidates.rs:60:1
|
|
|
|
|
LL | pub fn rcd(_x: Rc<u32>) -> bool {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn rcd(_x: Rc<u32>) -> bool`
|
|
|
|
error: this function could have a `#[must_use]` attribute
|
|
--> $DIR/must_use_candidates.rs:68:1
|
|
|
|
|
LL | pub fn arcd(_x: Arc<u32>) -> bool {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn arcd(_x: Arc<u32>) -> bool`
|
|
|
|
error: aborting due to 6 previous errors
|
|
|