Avoid renaming for TupleStruct with multiple arguments

update spec

fix: move specs in fire
This commit is contained in:
koka 2023-02-01 20:45:26 +09:00
parent 20338fd378
commit 07c8c50a41
No known key found for this signature in database
GPG key ID: 6C126A20CF0961EC
3 changed files with 48 additions and 20 deletions

View file

@ -156,7 +156,8 @@ fn emit_manual_let_else(
let (sn_pat, _) = snippet_with_context(cx, pat.span, span.ctxt(), "", &mut app);
format!("({sn_pat})")
},
PatKind::TupleStruct(ref w, ..) => {
// Replace the variable name iff `TupleStruct` has one argument like `Variant(v)`.
PatKind::TupleStruct(ref w, args, ..) if args.len() == 1 => {
let sn_wrapper = cx.sess().source_map().span_to_snippet(w.span()).unwrap_or_default();
let (sn_inner, _) = snippet_with_context(cx, local.span, span.ctxt(), "", &mut app);
format!("{sn_wrapper}({sn_inner})")