2019-09-25 17:49:56 +00:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
#![feature(box_syntax)]
|
|
|
|
#![allow(clippy::deref_addrof, dead_code, unused, clippy::no_effect)]
|
|
|
|
#![warn(clippy::unnecessary_operation)]
|
|
|
|
|
|
|
|
struct Tuple(i32);
|
|
|
|
struct Struct {
|
|
|
|
field: i32,
|
|
|
|
}
|
|
|
|
enum Enum {
|
|
|
|
Tuple(i32),
|
|
|
|
Struct { field: i32 },
|
|
|
|
}
|
|
|
|
struct DropStruct {
|
|
|
|
field: i32,
|
|
|
|
}
|
|
|
|
impl Drop for DropStruct {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
struct DropTuple(i32);
|
|
|
|
impl Drop for DropTuple {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
enum DropEnum {
|
|
|
|
Tuple(i32),
|
|
|
|
Struct { field: i32 },
|
|
|
|
}
|
|
|
|
impl Drop for DropEnum {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
struct FooString {
|
|
|
|
s: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_number() -> i32 {
|
|
|
|
0
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_usize() -> usize {
|
|
|
|
0
|
|
|
|
}
|
|
|
|
fn get_struct() -> Struct {
|
|
|
|
Struct { field: 0 }
|
|
|
|
}
|
|
|
|
fn get_drop_struct() -> DropStruct {
|
|
|
|
DropStruct { field: 0 }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
get_number();
|
|
|
|
get_number();
|
|
|
|
get_struct();
|
|
|
|
get_number();
|
|
|
|
get_number();
|
|
|
|
5;get_number();
|
|
|
|
get_number();
|
|
|
|
get_number();
|
|
|
|
5;6;get_number();
|
|
|
|
get_number();
|
|
|
|
get_number();
|
|
|
|
get_number();
|
|
|
|
5;get_number();
|
|
|
|
42;get_number();
|
2021-08-09 07:49:55 +00:00
|
|
|
assert!([42, 55].len() > get_usize());
|
2019-09-25 17:49:56 +00:00
|
|
|
42;get_number();
|
|
|
|
get_number();
|
2021-08-09 07:49:55 +00:00
|
|
|
assert!([42; 55].len() > get_usize());
|
2019-09-25 17:49:56 +00:00
|
|
|
get_number();
|
|
|
|
String::from("blah");
|
|
|
|
|
|
|
|
// Do not warn
|
|
|
|
DropTuple(get_number());
|
|
|
|
DropStruct { field: get_number() };
|
|
|
|
DropStruct { field: get_number() };
|
|
|
|
DropStruct { ..get_drop_struct() };
|
|
|
|
DropEnum::Tuple(get_number());
|
|
|
|
DropEnum::Struct { field: get_number() };
|
|
|
|
}
|