-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redundant closue lint can lose type annotation #8548
Comments
@rustbot claim |
@rustbot release-assignment |
Same kind of issue with a function pointer coming from C through the FFI that is passed as a |
I've ran into this issue with This code: pub async fn get_backup_path(&mut self) -> anyhow::Result<Option<PathBuf>> {
let path = sqlx::query("select value from config where key = 'backup_path'")
.fetch_optional(&mut self.transaction)
.await?
.map(|row| row.get(0));
Ok(path.map(|path: String| PathBuf::from(path)))
} Was "fixed" by Clippy by doing this: pub async fn get_backup_path(&mut self) -> anyhow::Result<Option<PathBuf>> {
let path = sqlx::query("select value from config where key = 'backup_path'")
.fetch_optional(&mut self.transaction)
.await?
.map(|row| row.get(0));
Ok(path.map(PathBuf::from))
} Which produced this error:
|
Summary
Redundant closure lint can lose type annotation. This can lead to
type annotation needed
error.Lint Name
redundant_closure
Reproducer
In this rather contrived code
Clippy reports the following
But if I do replace it, I get the following error
Version
No response
Additional Labels
No response
The text was updated successfully, but these errors were encountered: