1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
11 #![feature(tool_lints)]
13 #![feature(box_syntax)]
16 #![warn(clippy::no_effect, clippy::unnecessary_operation)]
18 #![allow(path_statements)]
19 #![allow(clippy::deref_addrof)]
20 #![allow(clippy::redundant_field_names)]
21 #![feature(untagged_unions)]
30 Struct { field: i32 },
33 impl Drop for DropUnit {
39 impl Drop for DropStruct {
42 struct DropTuple(i32);
43 impl Drop for DropTuple {
48 Struct { field: i32 },
50 impl Drop for DropEnum {
61 fn get_number() -> i32 { 0 }
62 fn get_struct() -> Struct { Struct { field: 0 } }
63 fn get_drop_struct() -> DropStruct { DropStruct { field: 0 } }
65 unsafe fn unsafe_fn() -> i32 { 0 }
69 let s2 = get_struct();
79 Enum::Struct { field: 0 };
97 let s: String = "foo".into();
102 unsafe { unsafe_fn() };
104 DropStruct { field: 0 };
107 DropEnum::Struct { field: 0 };
110 Struct { field: get_number() };
111 Struct { ..get_struct() };
112 Enum::Tuple(get_number());
113 Enum::Struct { field: get_number() };
117 (5, 6, get_number());
123 [42, 55][get_number() as usize];
124 (42, get_number()).1;
126 [42; 55][get_number() as usize];
128 FooString { s: String::from("blah"), };
131 DropTuple(get_number());
132 DropStruct { field: get_number() };
133 DropStruct { field: get_number() };
134 DropStruct { ..get_drop_struct() };
135 DropEnum::Tuple(get_number());
136 DropEnum::Struct { field: get_number() };