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.
Summary 📌
manual_unwrap_or
#66This PR introduces a new lint
manual_unwrap_or
that detects and suggests replacing manual match patterns forOption<T>
orResult<T, E>
with the more concise and readableunwrap_or
function, improving code clarity and conciseness.Changes Made ⚡️
Implementation of
manual_unwrap_or
Lintmanual_unwrap_or.rs
that detectsmatch
expressions reimplementing the behavior ofunwrap_or
forOption<T>
andResult<T, E>
.fix.rs
, converting manual match patterns to the more compactunwrap_or
call, preserving the original logic.manual
module to centralize logic for lints detecting manual patterns.Test Coverage 🥷🏼
test_files/manual_unwrap_or
to validate themanual_unwrap_or
lint:Option::Some
andOption::None
match tounwrap_or
.Result::Ok
andResult::Err
matches.Test Results ✅
Tests have been added and validated for the
manual_unwrap_or
lint. Some tests are failing due to potential conflicts between lints; however, individual validation confirms that themanual_unwrap_or
lint works as intended. I would appreciate feedback on this point. @0xLucqs 🫡