Auto merge of #89933 - est31:let_else, r=michaelwoerister
Adopt let_else across the compiler This performs a substitution of code following the pattern: ``` let <id> = if let <pat> = ... { identity } else { ... : ! }; ``` To simplify it to: ``` let <pat> = ... { identity } else { ... : ! }; ``` By adopting the `let_else` feature (cc #87335). The PR also updates the syn crate because the currently used version of the crate doesn't support `let_else` syntax yet. Note: Generally I'm the person who *removes* usages of unstable features from the compiler, not adds more usages of them, but in this instance I think it hopefully helps the feature get stabilized sooner and in a better state. I have written a [comment](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205) on the tracking issue about my experience and what I feel could be improved before stabilization of `let_else`.
This commit is contained in:
commit
1af55d19c7
54 changed files with 76 additions and 150 deletions
|
@ -3,6 +3,7 @@
|
|||
#![feature(core_intrinsics)]
|
||||
#![feature(hash_raw_entry)]
|
||||
#![feature(iter_zip)]
|
||||
#![feature(let_else)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(thread_local_const_init)]
|
||||
|
||||
|
|
|
@ -644,9 +644,7 @@ pub fn print_query_stack<CTX: QueryContext>(
|
|||
if Some(i) == num_frames {
|
||||
break;
|
||||
}
|
||||
let query_info = if let Some(info) = query_map.as_ref().and_then(|map| map.get(&query)) {
|
||||
info
|
||||
} else {
|
||||
let Some(query_info) = query_map.as_ref().and_then(|map| map.get(&query)) else {
|
||||
break;
|
||||
};
|
||||
let mut diag = Diagnostic::new(
|
||||
|
|
|
@ -761,11 +761,9 @@ where
|
|||
return false;
|
||||
}
|
||||
|
||||
let key = if let Some(key) =
|
||||
let Some(key) =
|
||||
<Q::Key as DepNodeParams<CTX::DepContext>>::recover(*tcx.dep_context(), &dep_node)
|
||||
{
|
||||
key
|
||||
} else {
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue