-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds test to make sure correct behavior of lint - The first test's option variable is not a temporary variable - The second test does not make usage of `take()` - The third test makes usage of `take()` and uses a temporary variable
- Loading branch information
Showing
3 changed files
with
22 additions
and
4 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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
println!("Testing option_take_on_temporary"); | ||
println!("Testing non erroneous option_take_on_temporary"); | ||
let mut option = Some(1); | ||
let _ = Box::new(move || option.take().unwrap()); | ||
|
||
println!("Testing non erroneous option_take_on_temporary"); | ||
let x = Some(3); | ||
x.as_ref(); | ||
|
||
println!("Testing erroneous option_take_on_temporary"); | ||
let x = Some(3); | ||
x.as_ref().take(); | ||
} |
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,7 +1,15 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
println!("Testing option_take_on_temporary"); | ||
println!("Testing non erroneous option_take_on_temporary"); | ||
let mut option = Some(1); | ||
let _ = Box::new(move || option.take().unwrap()); | ||
|
||
println!("Testing non erroneous option_take_on_temporary"); | ||
let x = Some(3); | ||
x.as_ref(); | ||
|
||
println!("Testing erroneous option_take_on_temporary"); | ||
let x = Some(3); | ||
x.as_ref(); | ||
} |