2018-01-23 10:54:57 -08:00
|
|
|
// ignore-tidy-tab
|
2020-07-02 14:32:12 +09:00
|
|
|
// run-rustfix
|
2018-01-23 10:54:57 -08:00
|
|
|
|
2017-10-21 00:00:57 +03:00
|
|
|
#![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
|
2017-09-29 23:52:51 -07:00
|
|
|
|
2018-06-27 22:50:24 -07:00
|
|
|
#[no_mangle] const DISCOVERY: usize = 1;
|
2019-07-19 00:05:23 +02:00
|
|
|
//~^ ERROR const items should never be `#[no_mangle]`
|
2018-06-27 22:50:24 -07:00
|
|
|
//~| HELP try a static value
|
2017-10-12 00:42:52 -07:00
|
|
|
|
2018-06-27 22:50:24 -07:00
|
|
|
#[no_mangle]
|
|
|
|
//~^ HELP remove this attribute
|
2017-10-12 00:42:52 -07: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 00:42:52 -07:00
|
|
|
|
|
|
|
#[no_mangle]
|
2018-06-27 22:50:24 -07:00
|
|
|
fn rio_grande() {}
|
2017-10-12 00:42:52 -07:00
|
|
|
|
2018-01-15 18:32:18 -08: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 15:58:11 -07:00
|
|
|
#[no_mangle] pub const DAUNTLESS: bool = true;
|
2019-07-19 00:05:23 +02:00
|
|
|
//~^ ERROR const items should never be `#[no_mangle]`
|
2018-09-21 15:58:11 -07:00
|
|
|
//~| HELP try a static value
|
2020-07-02 14:32:12 +09:00
|
|
|
#[allow(dead_code)] // for rustfix
|
2018-09-21 15:58:11 -07: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 15:58:11 -07:00
|
|
|
//~| HELP remove this attribute
|
2018-06-27 22:30:23 -07:00
|
|
|
|
|
|
|
// ... but we can suggest just-`pub` instead of restricted
|
2018-09-21 15:58:11 -07:00
|
|
|
#[no_mangle] pub(crate) const VETAR: bool = true;
|
2019-07-19 00:05:23 +02:00
|
|
|
//~^ ERROR const items should never be `#[no_mangle]`
|
2018-09-21 15:58:11 -07:00
|
|
|
//~| HELP try a static value
|
2020-07-02 14:32:12 +09:00
|
|
|
#[allow(dead_code)] // for rustfix
|
2018-09-21 15:58:11 -07: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 15:58:11 -07:00
|
|
|
//~| HELP remove this attribute
|
2018-01-15 18:32:18 -08:00
|
|
|
}
|
|
|
|
|
2017-10-12 00:42:52 -07:00
|
|
|
struct Equinox {
|
|
|
|
warp_factor: f32,
|
|
|
|
}
|
|
|
|
|
2017-09-29 23:52:51 -07:00
|
|
|
fn main() {
|
2018-06-27 22:50:24 -07:00
|
|
|
while true {
|
2017-11-20 13:13:27 +01:00
|
|
|
//~^ WARN denote infinite loops
|
2018-06-27 22:50:24 -07:00
|
|
|
//~| HELP use `loop`
|
2018-10-16 21:36:02 -07:00
|
|
|
let mut registry_no = (format!("NX-{}", 74205));
|
2017-11-20 13:13:27 +01:00
|
|
|
//~^ WARN does not need to be mutable
|
2018-06-27 22:50:24 -07:00
|
|
|
//~| HELP remove this `mut`
|
2017-11-20 13:13:27 +01:00
|
|
|
//~| WARN unnecessary parentheses
|
2018-06-27 22:50:24 -07:00
|
|
|
//~| HELP remove these parentheses
|
2018-01-23 10:54:57 -08: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-27 22:50:24 -07:00
|
|
|
//~| HELP remove this `mut`
|
2017-10-12 00:42:52 -07:00
|
|
|
let d = Equinox { warp_factor: 9.975 };
|
|
|
|
match d {
|
2020-07-02 14:32:12 +09:00
|
|
|
#[allow(unused_variables)] // for rustfix
|
2018-06-27 22:50:24 -07:00
|
|
|
Equinox { warp_factor: warp_factor } => {}
|
2017-11-20 13:13:27 +01:00
|
|
|
//~^ WARN this pattern is redundant
|
2019-12-22 07:59:38 +09:00
|
|
|
//~| HELP use shorthand field pattern
|
2017-10-12 00:42:52 -07:00
|
|
|
}
|
2018-10-16 21:36:02 -07:00
|
|
|
println!("{} {}", registry_no, b);
|
2017-09-29 23:52:51 -07:00
|
|
|
}
|
|
|
|
}
|