mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 12:13:43 +00:00
if let -> match
This commit is contained in:
parent
2dfb5e6ac0
commit
d618b1f2ce
@ -196,18 +196,16 @@ fn infer(content: &str) -> String {
|
|||||||
let body_syntax_mapping = func.body_syntax_mapping(&db).unwrap();
|
let body_syntax_mapping = func.body_syntax_mapping(&db).unwrap();
|
||||||
let mut types = Vec::new();
|
let mut types = Vec::new();
|
||||||
for (pat, ty) in inference_result.type_of_pat.iter() {
|
for (pat, ty) in inference_result.type_of_pat.iter() {
|
||||||
let syntax_ptr = if let Some(sp) = body_syntax_mapping.pat_syntax(pat) {
|
let syntax_ptr = match body_syntax_mapping.pat_syntax(pat) {
|
||||||
sp
|
Some(sp) => sp,
|
||||||
} else {
|
None => continue,
|
||||||
continue;
|
|
||||||
};
|
};
|
||||||
types.push((syntax_ptr, ty));
|
types.push((syntax_ptr, ty));
|
||||||
}
|
}
|
||||||
for (expr, ty) in inference_result.type_of_expr.iter() {
|
for (expr, ty) in inference_result.type_of_expr.iter() {
|
||||||
let syntax_ptr = if let Some(sp) = body_syntax_mapping.expr_syntax(expr) {
|
let syntax_ptr = match body_syntax_mapping.expr_syntax(expr) {
|
||||||
sp
|
Some(sp) => sp,
|
||||||
} else {
|
None => continue,
|
||||||
continue;
|
|
||||||
};
|
};
|
||||||
types.push((syntax_ptr, ty));
|
types.push((syntax_ptr, ty));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user