-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Problem
As for now, we have some inconsistency when it comes to manual_* lints. Some delete comments while fix and some doesn't. We want to make all of them support saving comments, like below:
From:
fn main() {
let foo: Option::<i32> = Option::None;
// This is just a variable.
let _foo = match foo {
Option::Some(_) => true,
Option::None => {
// do something
false
},
};
}To:
fn main() {
let foo: Option<i32> = Option::None;
// This is just a variable.
// do something
let _foo = foo.is_some();
}At the moment // do something will be deleted.
Proposed Solution
manual_unwrap_or_default has universal solution that can be applied to other lints
| fn extract_comments(db: &dyn SyntaxGroup, node: &SyntaxNode, indent: &str) -> String { |
Notes
No response
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog Lint