1
Fork 0

Auto merge of #75931 - estebank:suggest-if-let, r=petrochenkov

Suggest `if let x = y` when encountering `if x = y`

Detect potential cases where `if let` was meant but `let` was left out.

Fix #44990.
This commit is contained in:
bors 2020-09-01 00:26:01 +00:00
commit d824b23514
11 changed files with 268 additions and 102 deletions

View file

@ -213,6 +213,9 @@ pub struct Session {
known_attrs: Lock<MarkedAttrs>,
used_attrs: Lock<MarkedAttrs>,
/// `Span`s for `if` conditions that we have suggested turning into `if let`.
pub if_let_suggestions: Lock<FxHashSet<Span>>,
}
pub struct PerfStats {
@ -1354,6 +1357,7 @@ pub fn build_session(
target_features: FxHashSet::default(),
known_attrs: Lock::new(MarkedAttrs::new()),
used_attrs: Lock::new(MarkedAttrs::new()),
if_let_suggestions: Default::default(),
};
validate_commandline_args_with_session_available(&sess);