-
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 #8844 - smoelius:fixed-paths, r=Alexendoo,xFrednet
Check `.fixed` paths' existence in `run_ui` This PR adds a test to check that there exists a `.fixed` file for every `.stderr` file in `tests/ui` that mentions a `MachineApplicable` lint. The test leverages `compiletest-rs`'s `rustfix_coverage` option. I tried to add `.fixed` files where they appeared to be missing. However, 38 exceptional `.rs` files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.) changelog: none
- Loading branch information
Showing
55 changed files
with
1,807 additions
and
442 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
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,62 @@ | ||
// run-rustfix | ||
#![deny(clippy::bind_instead_of_map)] | ||
#![allow(clippy::blocks_in_if_conditions)] | ||
|
||
pub fn main() { | ||
let _ = Some("42").map(|s| if s.len() < 42 { 0 } else { s.len() }); | ||
let _ = Some("42").and_then(|s| if s.len() < 42 { None } else { Some(s.len()) }); | ||
|
||
let _ = Ok::<_, ()>("42").map(|s| if s.len() < 42 { 0 } else { s.len() }); | ||
let _ = Ok::<_, ()>("42").and_then(|s| if s.len() < 42 { Err(()) } else { Ok(s.len()) }); | ||
|
||
let _ = Err::<(), _>("42").map_err(|s| if s.len() < 42 { s.len() + 20 } else { s.len() }); | ||
let _ = Err::<(), _>("42").or_else(|s| if s.len() < 42 { Ok(()) } else { Err(s.len()) }); | ||
|
||
hard_example(); | ||
macro_example(); | ||
} | ||
|
||
fn hard_example() { | ||
Some("42").map(|s| { | ||
if { | ||
if s == "43" { | ||
return 43; | ||
} | ||
s == "42" | ||
} { | ||
return 45; | ||
} | ||
match s.len() { | ||
10 => 2, | ||
20 => { | ||
if foo() { | ||
return { | ||
if foo() { | ||
return 20; | ||
} | ||
println!("foo"); | ||
3 | ||
}; | ||
} | ||
20 | ||
}, | ||
40 => 30, | ||
_ => 1, | ||
} | ||
}); | ||
} | ||
|
||
fn foo() -> bool { | ||
true | ||
} | ||
|
||
macro_rules! m { | ||
() => { | ||
Some(10) | ||
}; | ||
} | ||
|
||
fn macro_example() { | ||
let _ = Some("").and_then(|s| if s.len() == 20 { m!() } else { Some(20) }); | ||
let _ = Some("").map(|s| if s.len() == 20 { m!() } else { Some(20) }); | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// run-rustfix | ||
#![deny(clippy::bind_instead_of_map)] | ||
#![allow(clippy::blocks_in_if_conditions)] | ||
|
||
|
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,12 @@ | ||
// run-rustfix | ||
#![allow(dead_code)] | ||
|
||
#[derive(Default)] | ||
struct A<T> { | ||
a: Vec<A<T>>, | ||
b: T, | ||
} | ||
|
||
fn main() { | ||
if Ok::<_, ()>(A::<String>::default()).is_ok() {} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
// run-rustfix | ||
#![allow(dead_code)] | ||
|
||
#[derive(Default)] | ||
struct A<T> { | ||
a: Vec<A<T>>, | ||
|
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,7 @@ | ||
// run-rustfix | ||
fn _f(s: &str) -> Option<()> { | ||
let _ = s[1..].split('.').next()?; | ||
Some(()) | ||
} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// run-rustfix | ||
fn _f(s: &str) -> Option<()> { | ||
let _ = s[1..].splitn(2, '.').next()?; | ||
Some(()) | ||
|
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,9 @@ | ||
// run-rustfix | ||
#![warn(clippy::let_unit_value)] | ||
|
||
fn f() {} | ||
static FN: fn() = f; | ||
|
||
fn main() { | ||
FN(); | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// run-rustfix | ||
#![warn(clippy::let_unit_value)] | ||
|
||
fn f() {} | ||
|
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.