]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/reasons.rs
feature-gate lint reasons
[rust.git] / src / test / ui / lint / reasons.rs
1 // compile-pass
2
3 #![feature(lint_reasons)]
4
5 #![warn(elided_lifetimes_in_paths,
6         //~^ NOTE lint level defined here
7         reason = "explicit anonymous lifetimes aid reasoning about ownership")]
8 #![warn(
9     nonstandard_style,
10     //~^ NOTE lint level defined here
11     reason = r#"people shouldn't have to change their usual style habits
12 to contribute to our project"#
13 )]
14 #![allow(unused, reason = "unused code has never killed anypony")]
15
16 use std::fmt;
17
18 pub struct CheaterDetectionMechanism {}
19
20 impl fmt::Debug for CheaterDetectionMechanism {
21     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
22         //~^ WARN hidden lifetime parameters in types are deprecated
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 such as
32     //~| NOTE people shouldn't have to change their usual style habits
33 }