-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #3626 - phansch:rustfix_works, r=oli-obk
Add run-rustfix where it already works This PR adds `// run-rustfix` headers to tests for `MachineApplicable` lints where applying the suggestions works without any errors.
- Loading branch information
Showing
30 changed files
with
467 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// run-rustfix | ||
|
||
#[warn(clippy::cast_lossless)] | ||
#[allow(clippy::no_effect, clippy::unnecessary_operation)] | ||
fn main() { | ||
// Test clippy::cast_lossless with casts to floating-point types | ||
f32::from(1i8); | ||
f64::from(1i8); | ||
f32::from(1u8); | ||
f64::from(1u8); | ||
f32::from(1i16); | ||
f64::from(1i16); | ||
f32::from(1u16); | ||
f64::from(1u16); | ||
f64::from(1i32); | ||
f64::from(1u32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// run-rustfix | ||
|
||
#[warn(clippy::cast_lossless)] | ||
#[allow(clippy::no_effect, clippy::unnecessary_operation)] | ||
fn main() { | ||
// Test clippy::cast_lossless with casts to integer types | ||
i16::from(1i8); | ||
i32::from(1i8); | ||
i64::from(1i8); | ||
i16::from(1u8); | ||
i32::from(1u8); | ||
i64::from(1u8); | ||
u16::from(1u8); | ||
u32::from(1u8); | ||
u64::from(1u8); | ||
i32::from(1i16); | ||
i64::from(1i16); | ||
i32::from(1u16); | ||
i64::from(1u16); | ||
u32::from(1u16); | ||
u64::from(1u16); | ||
i64::from(1i32); | ||
i64::from(1u32); | ||
u64::from(1u32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// run-rustfix | ||
|
||
fn main() { | ||
let x = 1; | ||
let y = 2; | ||
if x <= y { | ||
// do something | ||
} | ||
if x <= y { | ||
// do something | ||
} | ||
if x >= y { | ||
// do something | ||
} | ||
if x >= y { | ||
// do something | ||
} | ||
if x != y { | ||
// do something | ||
} | ||
if x != y { | ||
// do something | ||
} | ||
if x == y { | ||
// do something | ||
} | ||
if x == y { | ||
// do something | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.