Skip to content

Fix clippy warnings with new rust version, and upgrade rust version in CI#3556

Merged
stevenengler merged 8 commits intoshadow:mainfrom
stevenengler:test-new-rust
Apr 7, 2025
Merged

Fix clippy warnings with new rust version, and upgrade rust version in CI#3556
stevenengler merged 8 commits intoshadow:mainfrom
stevenengler:test-new-rust

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

No description provided.

```text
warning: the following explicit lifetimes could be elided: 'a
   --> lib/vasi-sync/src/scmutex.rs:255:24
    |
255 |     pub fn lock_pinned<'a>(self: Pin<&'a Self>) -> Pin<SelfContainedMutexGuard<'a, T>> {
    |                        ^^             ^^                                       ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
255 -     pub fn lock_pinned<'a>(self: Pin<&'a Self>) -> Pin<SelfContainedMutexGuard<'a, T>> {
255 +     pub fn lock_pinned(self: Pin<&Self>) -> Pin<SelfContainedMutexGuard<'_, T>> {
```
```text
warning: manual implementation of `err`
   --> test/test_utils.rs:595:25
    |
595 |           .filter_map(|v| match v {
    |  _________________________^
596 | |             Err(verify) => Some(verify),
597 | |             _ => None,
598 | |         })
    | |_________^ help: replace with: `v.err()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err
    = note: `#[warn(clippy::manual_ok_err)]` on by default
```
```text
warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
  --> test/environment/test_env.rs:25:24
   |
25 |     assert!(ld_preload.last().unwrap() == "/my/custom/ld/preload/path.so");
   |                        ^^^^^^ help: try: `next_back()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
   = note: `#[warn(clippy::double_ended_iterator_last)]` on by default
```
```text
warning: this `repeat().take()` can be written more concisely
  --> main/utility/byte_queue.rs:70:29
   |
70 |         BytesMut::from_iter(std::iter::repeat(0).take(size))
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(0, size)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n
   = note: `#[warn(clippy::manual_repeat_n)]` on by default
```
```text
warning: length comparison to zero
   --> main/host/process.rs:331:46
    |
331 |         if !clear_child_tid_pvp.is_null() && self.threads.borrow().len() > 0 {
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.threads.borrow().is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
    = note: `#[warn(clippy::len_zero)]` on by default
```
```text
warning: doc list item overindented
   --> main/core/work/task.rs:185:9
    |
185 |     ///    for `HostTreePointer::new`.
    |         ^^^ help: try using `  ` (2 spaces)
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items
    = note: `#[warn(clippy::doc_overindented_list_items)]` on by default
```
@stevenengler stevenengler added the Type: Maintenance Refactoring, cleanup, documenation, or process improvements label Apr 6, 2025
@stevenengler stevenengler self-assigned this Apr 6, 2025
@github-actions github-actions bot added Component: Libraries Support functions like LD_PRELOAD and logging Component: Testing Unit and integration tests and frameworks Component: Main Composing the core Shadow executable labels Apr 6, 2025
@github-actions github-actions bot added the Component: Documentation In-repository documentation, under docs/ label Apr 6, 2025
@stevenengler stevenengler requested a review from a team April 6, 2025 18:57
@stevenengler stevenengler enabled auto-merge April 6, 2025 18:58
@stevenengler stevenengler merged commit ecaa42d into shadow:main Apr 7, 2025
25 checks passed
@stevenengler stevenengler deleted the test-new-rust branch April 7, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Documentation In-repository documentation, under docs/ Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable Component: Testing Unit and integration tests and frameworks Type: Maintenance Refactoring, cleanup, documenation, or process improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants