Adopt let else in more places
This commit is contained in:
@@ -16,9 +16,8 @@ pub fn expand_option_env<'cx>(
|
||||
sp: Span,
|
||||
tts: TokenStream,
|
||||
) -> Box<dyn base::MacResult + 'cx> {
|
||||
let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") {
|
||||
None => return DummyResult::any(sp),
|
||||
Some(v) => v,
|
||||
let Some(var) = get_single_str_from_tts(cx, sp, tts, "option_env!") else {
|
||||
return DummyResult::any(sp);
|
||||
};
|
||||
|
||||
let sp = cx.with_def_site_ctxt(sp);
|
||||
@@ -62,9 +61,8 @@ pub fn expand_env<'cx>(
|
||||
Some(exprs) => exprs.into_iter(),
|
||||
};
|
||||
|
||||
let var = match expr_to_string(cx, exprs.next().unwrap(), "expected string literal") {
|
||||
None => return DummyResult::any(sp),
|
||||
Some((v, _style)) => v,
|
||||
let Some((var, _style)) = expr_to_string(cx, exprs.next().unwrap(), "expected string literal") else {
|
||||
return DummyResult::any(sp);
|
||||
};
|
||||
let msg = match exprs.next() {
|
||||
None => Symbol::intern(&format!("environment variable `{}` not defined", var)),
|
||||
|
||||
Reference in New Issue
Block a user