Skip to content
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

CI: Lint the crate and examples #671

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ mod prelude {
impl<T: ?Sized> Deref for MutexGuard<'_, T> {
type Target = T;

fn deref(&self) -> &T { &self.lock.deref() }
fn deref(&self) -> &T { self.lock.deref() }
}

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

pub fn lock<'a>(&'a self) -> LockResult<MutexGuard<'a, T>> {
pub fn lock(&self) -> LockResult<MutexGuard<'_, T>> {
Ok(MutexGuard { lock: self.inner.borrow_mut() })
}
}
Expand Down
Loading