]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/attrs.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / attrs.rs
1 #![warn(clippy::inline_always, clippy::deprecated_semver)]
2 #![allow(clippy::assertions_on_constants)]
3 #![allow(clippy::missing_docs_in_private_items, clippy::panic, clippy::unreachable)]
4
5 #[inline(always)]
6 //~^ ERROR: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a b
7 //~| NOTE: `-D clippy::inline-always` implied by `-D warnings`
8 fn test_attr_lint() {
9 assert!(true)
10 }
11
12 #[inline(always)]
13 fn false_positive_expr() {
14 unreachable!()
15 }
16
17 #[inline(always)]
18 fn false_positive_stmt() {
19 unreachable!();
20 }
21
22 #[inline(always)]
23 fn empty_and_false_positive_stmt() {
24 unreachable!();
25 }
26
27 #[deprecated(since = "forever")]
28 //~^ ERROR: the since field must contain a semver-compliant version
29 //~| NOTE: `-D clippy::deprecated-semver` implied by `-D warnings`
30 pub const SOME_CONST: u8 = 42;
31
32 #[deprecated(since = "1")]
33 //~^ ERROR: the since field must contain a semver-compliant version
34 pub const ANOTHER_CONST: u8 = 23;
35
36 #[deprecated(since = "0.1.1")]
37 pub const YET_ANOTHER_CONST: u8 = 0;
38
39 fn main() {
40 test_attr_lint();
41 if false {
42 false_positive_expr()
43 }
44 if false {
45 false_positive_stmt()
46 }
47 if false {
48 empty_and_false_positive_stmt()
49 }
50 }