summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/reasons.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/lint/reasons.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/reasons.rs')
-rw-r--r--tests/ui/lint/reasons.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/lint/reasons.rs b/tests/ui/lint/reasons.rs
new file mode 100644
index 000000000..da1c740c4
--- /dev/null
+++ b/tests/ui/lint/reasons.rs
@@ -0,0 +1,35 @@
+// check-pass
+
+#![feature(lint_reasons)]
+#![warn(elided_lifetimes_in_paths,
+ //~^ NOTE the lint level is defined here
+ reason = "explicit anonymous lifetimes aid reasoning about ownership")]
+#![warn(
+ nonstandard_style,
+ //~^ NOTE the lint level is defined here
+ reason = r#"people shouldn't have to change their usual style habits
+to contribute to our project"#
+)]
+#![allow(unused, reason = "unused code has never killed anypony")]
+
+use std::fmt;
+
+pub struct CheaterDetectionMechanism {}
+
+impl fmt::Debug for CheaterDetectionMechanism {
+ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ //~^ WARN hidden lifetime parameters in types are deprecated
+ //~| NOTE expected lifetime parameter
+ //~| NOTE explicit anonymous lifetimes aid
+ //~| HELP indicate the anonymous lifetime
+ fmt.debug_struct("CheaterDetectionMechanism").finish()
+ }
+}
+
+fn main() {
+ let Social_exchange_psychology = CheaterDetectionMechanism {};
+ //~^ WARN should have a snake case name
+ //~| NOTE #[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]
+ //~| NOTE people shouldn't have to change their usual style habits
+ //~| HELP convert the identifier to snake case
+}