Skip to content

Commit

Permalink
Fix new lint warning in clippy_config
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 1, 2023
1 parent 22f0c00 commit 80780d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ macro_rules! define_Conf {
}
})*
// ignore contents of the third_party key
Ok(Field::third_party) => drop(map.next_value::<IgnoredAny>())
Ok(Field::third_party) => {
let _ = map.next_value::<IgnoredAny>();
}
}
}
let conf = Conf { $($name: $name.unwrap_or_else(defaults::$name),)* };
Expand Down
2 changes: 1 addition & 1 deletion clippy_dev/src/update_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ fn try_rename_file(old_name: &Path, new_name: &Path) -> bool {
match fs::rename(old_name, new_name) {
Ok(()) => true,
Err(e) => {
drop(fs::remove_file(new_name));
let _ = fs::remove_file(new_name);
if e.kind() == io::ErrorKind::NotFound {
false
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/drop_result.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[warn(clippy::drop_result)]
#![warn(clippy::drop_result)]

fn make_result<T>(t: T) -> Result<T, ()> {
Ok(t)
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/drop_result.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: using `drop()` on a `Result` type
--> $DIR/drop_result.rs:6:5
--> $DIR/drop_result.rs:8:5
|
LL | drop(Ok::<String, ()>("a".to_string()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -8,13 +8,13 @@ LL | drop(Ok::<String, ()>("a".to_string()));
= help: to override `-D warnings` add `#[allow(clippy::drop_result)]`

error: using `drop()` on a `Result` type
--> $DIR/drop_result.rs:8:5
--> $DIR/drop_result.rs:10:5
|
LL | drop(x);
| ^^^^^^^

error: using `drop()` on a `Result` type
--> $DIR/drop_result.rs:9:5
--> $DIR/drop_result.rs:11:5
|
LL | drop(make_result("a".to_string()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit 80780d8

Please sign in to comment.