Skip to content

Commit a548edd

Browse files
committed
Merge #671: CI: Lint the crate and examples
a410c06 CI: Lint the crate (Tobin C. Harding) 597db61 Remove explicit lifetime (Tobin C. Harding) 3623281 Remove unnecessary reference (Tobin C. Harding) Pull request description: We are not currently running the linter in CI, do so. ACKs for top commit: apoelstra: ACK a410c06 Tree-SHA512: 7173394e5fa857e557093ce1ddf4f06d9143c2c37f484800b55f31c6ebef49fad884b277d642426fc0ef0bf5c8971859655fb1607a5c6953d0deb0fd1c094d63
2 parents f44943d + a410c06 commit a548edd

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.github/workflows/rust.yml

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
profile: minimal
1616
toolchain: nightly
1717
override: true
18+
- name: Install clippy
19+
run: rustup component add clippy
1820
- name: Running benchmarks
1921
env:
2022
DO_BENCH: true
@@ -27,6 +29,10 @@ jobs:
2729
env:
2830
DO_FMT: true
2931
run: ./contrib/test.sh
32+
- name: Running linter
33+
env:
34+
DO_LINT: true
35+
run: ./contrib/test.sh
3036

3137
Int-tests:
3238
name: Integration tests

contrib/test.sh

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ fi
3333
# Defaults / sanity checks
3434
cargo test
3535

36+
if [ "$DO_LINT" = true ]; then
37+
clippy="cargo +nightly clippy"
38+
39+
$clippy --all-features --all-targets -- -D warnings
40+
$clippy --all-targets -- -D warnings
41+
$clippy --no-default-features --features=no-std --all-targets -- -D warnings
42+
fi
43+
3644
if [ "$DO_FEATURE_MATRIX" = true ]
3745
then
3846
# All features

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ mod prelude {
754754
impl<T: ?Sized> Deref for MutexGuard<'_, T> {
755755
type Target = T;
756756

757-
fn deref(&self) -> &T { &self.lock.deref() }
757+
fn deref(&self) -> &T { self.lock.deref() }
758758
}
759759

760760
impl<T: ?Sized> DerefMut for MutexGuard<'_, T> {
@@ -764,7 +764,7 @@ mod prelude {
764764
impl<T> Mutex<T> {
765765
pub fn new(inner: T) -> Mutex<T> { Mutex { inner: RefCell::new(inner) } }
766766

767-
pub fn lock<'a>(&'a self) -> LockResult<MutexGuard<'a, T>> {
767+
pub fn lock(&self) -> LockResult<MutexGuard<'_, T>> {
768768
Ok(MutexGuard { lock: self.inner.borrow_mut() })
769769
}
770770
}

0 commit comments

Comments
 (0)