diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 333c80d7d..7a50ba319 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,6 +15,8 @@ jobs: profile: minimal toolchain: nightly override: true + - name: Install clippy + run: rustup component add clippy - name: Running benchmarks env: DO_BENCH: true @@ -27,6 +29,10 @@ jobs: env: DO_FMT: true run: ./contrib/test.sh + - name: Running linter + env: + DO_LINT: true + run: ./contrib/test.sh Int-tests: name: Integration tests diff --git a/contrib/test.sh b/contrib/test.sh index be50ca451..dad7cb356 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -33,6 +33,14 @@ fi # Defaults / sanity checks cargo test +if [ "$DO_LINT" = true ]; then + clippy="cargo +nightly clippy" + + $clippy --all-features --all-targets -- -D warnings + $clippy --all-targets -- -D warnings + $clippy --no-default-features --features=no-std --all-targets -- -D warnings +fi + if [ "$DO_FEATURE_MATRIX" = true ] then # All features diff --git a/src/lib.rs b/src/lib.rs index 277e50662..e6b999aca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -754,7 +754,7 @@ mod prelude { impl Deref for MutexGuard<'_, T> { type Target = T; - fn deref(&self) -> &T { &self.lock.deref() } + fn deref(&self) -> &T { self.lock.deref() } } impl DerefMut for MutexGuard<'_, T> { @@ -764,7 +764,7 @@ mod prelude { impl Mutex { pub fn new(inner: T) -> Mutex { Mutex { inner: RefCell::new(inner) } } - pub fn lock<'a>(&'a self) -> LockResult> { + pub fn lock(&self) -> LockResult> { Ok(MutexGuard { lock: self.inner.borrow_mut() }) } }