-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix new 1.81.0 warning and clippy error #760
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1b805af
fix new 1.81.0 warning and clippy error
iximeow 6e02d1d
the unused pub(crate) struct warnings are new also, allow these cases
iximeow 98ef716
inspect_err is a new one to me! really don't like this clippy lint
iximeow 2f1a483
fix copypaste in comment
iximeow 7e80d6e
try a different shade of paint
iximeow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this suggestion kinda makes my skin crawl. "inspect_err" sounds a lot like you should expect
println!()
or something boring to follow, but on the next like we are destroying a resource because of the error. i'm not interested in adding#![allow(clippy::manual_inspect)]
in an ad-hoc manner at crate roots though, so.. this what the suggested fix looks like.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional, just noodling on the problem a bit: does it look any better to write it out by hand?
Or we could just write out the
?
match explicitly. I don't have especially strong feelings here--it does seem likeinspect
is not quite the right verb for what we're trying to do here, but I'm not too suremap
was either, since this wasn't transforming the error at all. Up to you in any case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd given that one a try and realized i was having a hard time reading it after the fact, since the
?
and exit control flow is separated away from.is_err()
. an explicit match would probably read fine though, i'll do that in a secThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the drive-by comment, but might this be
or_else
?To me, the
or_else
says "we're doing something if this fails."There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd have liked
or_else
a lot but it turns out that is also on the path toinspect_err
: that results in Clippy offering "usingResult.or_else(|x| Err(y))
, which is more succinctly expressed asmap_err(|x| y)
. it's right, but then with that transform Clippy points towardsinspect_err
. 🙃anyway, i've adjusted this to be an explicit match on both cases. seems fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aww Clippy, why ya gotta be like that? :-/