]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/reasons.rs
Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
[rust.git] / tests / ui / lint / reasons.rs
1 // check-pass
2
3 #![feature(lint_reasons)]
4 #![warn(elided_lifetimes_in_paths,
5         //~^ NOTE the lint level is defined here
6         reason = "explicit anonymous lifetimes aid reasoning about ownership")]
7 #![warn(
8     nonstandard_style,
9     //~^ NOTE the lint level is defined here
10     reason = r#"people shouldn't have to change their usual style habits
11 to contribute to our project"#
12 )]
13 #![allow(unused, reason = "unused code has never killed anypony")]
14
15 use std::fmt;
16
17 pub struct CheaterDetectionMechanism {}
18
19 impl fmt::Debug for CheaterDetectionMechanism {
20     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
21         //~^ WARN hidden lifetime parameters in types are deprecated
22         //~| NOTE expected lifetime parameter
23         //~| NOTE explicit anonymous lifetimes aid
24         //~| HELP indicate the anonymous lifetime
25         fmt.debug_struct("CheaterDetectionMechanism").finish()
26     }
27 }
28
29 fn main() {
30     let Social_exchange_psychology = CheaterDetectionMechanism {};
31     //~^ WARN should have a snake case name
32     //~| NOTE #[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]
33     //~| NOTE people shouldn't have to change their usual style habits
34     //~| HELP convert the identifier to snake case
35 }