2018-01-23 18:54:57 +00:00
|
|
|
// ignore-tidy-tab
|
2020-07-02 05:32:12 +00:00
|
|
|
// run-rustfix
|
2018-01-23 18:54:57 +00:00
|
|
|
|
2017-10-20 21:00:57 +00:00
|
|
|
#![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
|
2017-09-30 06:52:51 +00:00
|
|
|
|
2018-06-28 05:50:24 +00:00
|
|
|
#[no_mangle] const DISCOVERY: usize = 1;
|
2019-07-18 22:05:23 +00:00
|
|
|
//~^ ERROR const items should never be `#[no_mangle]`
|
2018-06-28 05:50:24 +00:00
|
|
|
//~| HELP try a static value
|
2017-10-12 07:42:52 +00:00
|
|
|
|
2018-06-28 05:50:24 +00:00
|
|
|
#[no_mangle]
|
|
|
|
//~^ HELP remove this attribute
|
2017-10-12 07:42:52 +00:00
|
|
|
pub fn defiant<T>(_t: T) {}
|
2019-02-15 22:26:36 +00:00
|
|
|
//~^ WARN functions generic over types or consts must be mangled
|
2017-10-12 07:42:52 +00:00
|
|
|
|
|
|
|
#[no_mangle]
|
2018-06-28 05:50:24 +00:00
|
|
|
fn rio_grande() {}
|
2017-10-12 07:42:52 +00:00
|
|
|
|
2018-01-16 02:32:18 +00:00
|
|
|
mod badlands {
|
|
|
|
// The private-no-mangle lints shouldn't suggest inserting `pub` when the
|
|
|
|
// item is already `pub` (but triggered the lint because, e.g., it's in a
|
|
|
|
// private module). (Issue #47383)
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle] pub const DAUNTLESS: bool = true;
|
2019-07-18 22:05:23 +00:00
|
|
|
//~^ ERROR const items should never be `#[no_mangle]`
|
2018-09-21 22:58:11 +00:00
|
|
|
//~| HELP try a static value
|
2020-07-02 05:32:12 +00:00
|
|
|
#[allow(dead_code)] // for rustfix
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle] pub fn val_jean<T>() {}
|
2019-02-15 22:26:36 +00:00
|
|
|
//~^ WARN functions generic over types or consts must be mangled
|
2018-09-21 22:58:11 +00:00
|
|
|
//~| HELP remove this attribute
|
2018-06-28 05:30:23 +00:00
|
|
|
|
|
|
|
// ... but we can suggest just-`pub` instead of restricted
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle] pub(crate) const VETAR: bool = true;
|
2019-07-18 22:05:23 +00:00
|
|
|
//~^ ERROR const items should never be `#[no_mangle]`
|
2018-09-21 22:58:11 +00:00
|
|
|
//~| HELP try a static value
|
2020-07-02 05:32:12 +00:00
|
|
|
#[allow(dead_code)] // for rustfix
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle] pub(crate) fn crossfield<T>() {}
|
2019-02-15 22:26:36 +00:00
|
|
|
//~^ WARN functions generic over types or consts must be mangled
|
2018-09-21 22:58:11 +00:00
|
|
|
//~| HELP remove this attribute
|
2018-01-16 02:32:18 +00:00
|
|
|
}
|
|
|
|
|
2017-10-12 07:42:52 +00:00
|
|
|
struct Equinox {
|
|
|
|
warp_factor: f32,
|
|
|
|
}
|
|
|
|
|
2017-09-30 06:52:51 +00:00
|
|
|
fn main() {
|
2018-06-28 05:50:24 +00:00
|
|
|
while true {
|
2017-11-20 12:13:27 +00:00
|
|
|
//~^ WARN denote infinite loops
|
2018-06-28 05:50:24 +00:00
|
|
|
//~| HELP use `loop`
|
2018-10-17 04:36:02 +00:00
|
|
|
let mut registry_no = (format!("NX-{}", 74205));
|
2017-11-20 12:13:27 +00:00
|
|
|
//~^ WARN does not need to be mutable
|
2018-06-28 05:50:24 +00:00
|
|
|
//~| HELP remove this `mut`
|
2017-11-20 12:13:27 +00:00
|
|
|
//~| WARN unnecessary parentheses
|
2018-06-28 05:50:24 +00:00
|
|
|
//~| HELP remove these parentheses
|
2018-01-23 18:54:57 +00:00
|
|
|
// the line after `mut` has a `\t` at the beginning, this is on purpose
|
|
|
|
let mut
|
|
|
|
b = 1;
|
|
|
|
//~^^ WARN does not need to be mutable
|
2018-06-28 05:50:24 +00:00
|
|
|
//~| HELP remove this `mut`
|
2017-10-12 07:42:52 +00:00
|
|
|
let d = Equinox { warp_factor: 9.975 };
|
|
|
|
match d {
|
2020-07-02 05:32:12 +00:00
|
|
|
#[allow(unused_variables)] // for rustfix
|
2018-06-28 05:50:24 +00:00
|
|
|
Equinox { warp_factor: warp_factor } => {}
|
2017-11-20 12:13:27 +00:00
|
|
|
//~^ WARN this pattern is redundant
|
2019-12-21 22:59:38 +00:00
|
|
|
//~| HELP use shorthand field pattern
|
2017-10-12 07:42:52 +00:00
|
|
|
}
|
2018-10-17 04:36:02 +00:00
|
|
|
println!("{} {}", registry_no, b);
|
2017-09-30 06:52:51 +00:00
|
|
|
}
|
|
|
|
}
|