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
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:
To:
At the moment
// do somethingwill be deleted.Proposed Solution
manual_unwrap_or_defaulthas universal solution that can be applied to other lintscairo-lint/src/lints/manual/manual_unwrap_or_default.rs
Line 163 in 7290b89
Notes
No response