-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingL-correctnessLint: Belongs in the correctness lint groupLint: Belongs in the correctness lint groupT-async-awaitType: Issues related to async/awaitType: Issues related to async/awaitgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
I'm getting an error with the following code:
use std::path::{Path, PathBuf};
use tokio::fs;
async fn exists(path: impl AsRef<Path>) -> bool {
fs::metadata(path).await.is_ok()
}
#[tokio::main]
async fn main() {
let path = PathBuf::from("");
debug_assert!(!exists(&path).await);
}
error: do not call a function with mutable arguments inside of `debug_assert!`
--> src/main.rs:11:20
|
11 | debug_assert!(!exists(&path).await);
| ^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::debug_assert_with_mut_call)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#debug_assert_with_mut_call
error: aborting due to previous error
Note that this doesn't occur with the equivalent blocking version:
use std::path::{Path, PathBuf};
fn exists(path: impl AsRef<Path>) -> bool {
path.as_ref().exists()
}
fn main() {
let path = PathBuf::from("");
debug_assert!(!exists(&path));
}
Is this expected behaviour?
porkbrain
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingL-correctnessLint: Belongs in the correctness lint groupLint: Belongs in the correctness lint groupT-async-awaitType: Issues related to async/awaitType: Issues related to async/awaitgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy