Closed yonip23 closed 2 years ago
I can't manage to make a repro. Can you share the code? It's failing on a Result
type for some function.
I can't manage to make a repro. Can you share the code? It's failing on a
Result
type for some function.
The Result
hint allowed me to trim down chunks of my code and being able to reproduce with this minimal example:
use std::{
error::Error,
sync::{Mutex, MutexGuard},
};
#[cfg(test)]
mod tests;
pub type Result<'a, T> = std::result::Result<T, Box<dyn 'a + Error>>;
#[derive(Default)]
pub struct Foo<T: Send> {
data: Mutex<T>,
}
pub struct WriteLock<'a, T: Send + 'a>(MutexGuard<'a, T>);
impl<'a, T: Send + 'a> WriteLock<'a, T> {
pub fn get(&self) -> &T {
&self.0
}
}
impl<T: Sync + Send> Foo<T> {
pub fn foo(&self) -> Result<WriteLock<T>> {
Ok(WriteLock(self.data.try_lock()?))
}
}
Looks like the latest nightly is working (2022-08-31)
My clippy version is 09-01 🤔 As shown in my info section above ^
I guess the playground hadn't updated by the time I checked.
Thank you so much for the quick response and fix!👏
The change will be in nightly about a week from now.
Thanks for the very fast fix, we hit that too in our CI !
Hey all, I get this message when running clippy nightly on my project:
Info
lib.rs
with ~70 lines, andtests.rs
with 12 lines)unsafe
or anythingworkspace
configuration, and ~80 other crates (Idk if it helps, just trying to provide as much relevant context as I can)os: Ubuntu 20.04
Please lmk if there's anything else you need from me, and thank you for this amazing project! 🙂