]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/suggestions.rs
Add several lints into `unused` lint group
[rust.git] / src / test / ui / lint / suggestions.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
12 #![feature(no_debug)]
13
14 #[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub`
15 #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const`
16
17 #[no_mangle] // should suggest removal (generics can't be no-mangle)
18 pub fn defiant<T>(_t: T) {}
19
20 #[no_mangle]
21 fn rio_grande() {} // should suggest `pub`
22
23 struct Equinox {
24     warp_factor: f32,
25 }
26
27 #[no_debug] // should suggest removal of deprecated attribute
28 fn main() {
29     while true { // should suggest `loop`
30         let mut a = (1); // should suggest no `mut`, no parens
31         let d = Equinox { warp_factor: 9.975 };
32         match d {
33             Equinox { warp_factor: warp_factor } => {} // should suggest shorthand
34         }
35         println!("{}", a);
36     }
37 }