Skip to content

Fix rust/clippy warnings in rust 1.89.0#3653

Merged
stevenengler merged 6 commits intoshadow:mainfrom
stevenengler:upgrade-rust
Sep 9, 2025
Merged

Fix rust/clippy warnings in rust 1.89.0#3653
stevenengler merged 6 commits intoshadow:mainfrom
stevenengler:upgrade-rust

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

@stevenengler stevenengler commented Sep 7, 2025

Another rust release, another painful collection of warnings to fix. Might be easier to review with git diff -w (edit: it looks like this is available in the github view as well).

This also upgrades the bindgen version used in linux-api bindings.

Edit: This was originally an MR to fix the warnings and update our CI to use rust 1.89.0. But we can't update to 1.89.0 due to #3654. So this MR now just fixes the warnings without updating the CI.

```text
warning: hiding a lifetime that's elided elsewhere is confusing
   --> lib/vasi-sync/src/atomic_tls_map.rs:135:23
    |
135 |     pub unsafe fn get(&self, key: NonZeroUsize) -> Option<Ref<V>> {
    |                       ^^^^^ the lifetime is elided here   ------ the same lifetime is hidden here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
    |
135 |     pub unsafe fn get(&self, key: NonZeroUsize) -> Option<Ref<'_, V>> {
    |                                                               +++
```
```text
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
    --> lib/linux-api/src/bindings.rs:4238:5
     |
4236 | #[derive(Debug, Copy, Clone, PartialEq, Eq)]
     |                              --------- in this derive macro expansion
4237 | pub struct linux_sigaction {
4238 |     pub lsa_handler: linux___sighandler_t,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: the address of the same function can vary between different codegen units
     = note: furthermore, different functions could have the same address after being merged together
     = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>
     = note: `#[warn(unpredictable_function_pointer_comparisons)]` on by default
```
```text
warning: this `if` statement can be collapsed
   --> main/utility/byte_queue.rs:145:9
    |
145 | /         if let Some(ref unused_buffer) = self.unused_buffer {
146 | |             if unused_buffer.is_empty() {
147 | |                 self.unused_buffer = None;
148 | |             }
149 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
    = note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
    |
145 ~         if let Some(ref unused_buffer) = self.unused_buffer
146 ~             && unused_buffer.is_empty() {
147 |                 self.unused_buffer = None;
148 ~             }
```
@stevenengler stevenengler self-assigned this Sep 7, 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 Component: Documentation In-repository documentation, under docs/ labels Sep 7, 2025
@stevenengler
Copy link
Copy Markdown
Contributor Author

stevenengler commented Sep 7, 2025

This is blocked on #3654.

I changed this MR to not update the rust version in the CI, so we're no longer blocked.

@stevenengler stevenengler added the Status: Blocked Progress depends on completing other work first label Sep 7, 2025
@stevenengler stevenengler changed the title Upgrade rust in CI to 1.89.0 Fix rust/clippy warnings in rust 1.89.0 Sep 7, 2025
@stevenengler stevenengler removed the Status: Blocked Progress depends on completing other work first label Sep 7, 2025
@stevenengler stevenengler requested a review from a team September 7, 2025 22:45
@stevenengler stevenengler merged commit a7a4f57 into shadow:main Sep 9, 2025
26 checks passed
@stevenengler stevenengler deleted the upgrade-rust branch September 9, 2025 01:17
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants