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

Add Clippy lints to CI #196

Merged
merged 4 commits into from
Aug 12, 2022
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
7 changes: 6 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ jobs:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.47.0
toolchain: 1.49.0
override: true
components: clippy
- name: Check rust and cargo version
run: rustc -V && cargo -V
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run Clippy lints
run: cargo clippy --verbose -- -D warnings
- name: Build (no default features)
run: cargo build --verbose --no-default-features
- name: Run tests (no default features)
run: cargo test --verbose --no-default-features
- name: Run Clippy lints (no default features)
run: cargo clippy --verbose --no-default-features -- -D warnings
19 changes: 13 additions & 6 deletions src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ impl<'a> Events<'a> {
-> Self
{
Events {
fd : fd,
buffer : buffer,
num_bytes: num_bytes,
pos : 0,
fd,
buffer,
num_bytes,
pos: 0,
}
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@ impl<'a> Event<&'a OsStr> {
fd,
};

let name = if name == "" {
let name = if name.is_empty() {
None
}
else {
Expand Down Expand Up @@ -206,8 +206,15 @@ impl<'a> Event<&'a OsStr> {
}

/// Returns an owned copy of the event.
#[must_use = "cloning is often expensive and is not expected to have side effects"]
#[deprecated = "use `to_owned()` instead; methods named `into_owned()` usually take self by value"]
#[allow(clippy::wrong_self_convention)]
pub fn into_owned(&self) -> EventOwned {
self.to_owned()
}

/// Returns an owned copy of the event.
#[must_use = "cloning is often expensive and is not expected to have side effects"]
pub fn to_owned(&self) -> EventOwned {
Event {
wd: self.wd.clone(),
mask: self.mask,
Expand Down
4 changes: 2 additions & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
pub(crate) fn new(fd: Arc<FdGuard>, buffer: T) -> io::Result<Self> {
Ok(EventStream {
fd: AsyncFd::new(ArcFdGuard(fd))?,
buffer: buffer,
buffer,
buffer_pos: 0,
unused_bytes: 0,
})
Expand Down Expand Up @@ -73,7 +73,7 @@ where
self_.buffer_pos += bytes_consumed;
self_.unused_bytes -= bytes_consumed;

Poll::Ready(Some(Ok(event.into_owned())))
Poll::Ready(Some(Ok(event.to_owned())))
}
}

Expand Down