Skip to content

Clippy fixes#642

Open
ratmice wants to merge 4 commits into
softdevteam:masterfrom
ratmice:clippy_fix
Open

Clippy fixes#642
ratmice wants to merge 4 commits into
softdevteam:masterfrom
ratmice:clippy_fix

Conversation

@ratmice

@ratmice ratmice commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

The first patch is hand written, so that the subsequent cargo clippy --fix won't introduce compilation errors with the borrow checker.

ratmice added 3 commits July 11, 2026 17:27
The code after running `cargo clippy --fix` seems to require this change,
The suggestions and code modifications introduce a borrow checker error.

Clippy changes a return statement from `return Err(...);`, to `Err(...)?;`.
However the borrow checker can tell `return Err(...)` can't fall through.
But after the change the compiler isn't smart enough to infer that
 `Err(...)?;` can't fall through because it can never be an `Ok` value.
@ratmice

ratmice commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

Perhaps rather than adding the trait impl, instead I should put more effort into rewriting the code block?

Maybe a match parsed_header block would fix it because it currently errors later when we parsed_header.unwrap(), and when using match the compiler knows both arms are disjoint.

Edit: That will work, but it is a 200+ line Ok(...) block for the rest of the function, which the unwrap was preventing indentation of. However the clippy if let ... && ... has reduced the indentation on the inner block significantly, so it really doesn't too terribly.

I went ahead and pushed that, happy to back it out though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants