willothy / worth

Found redundant let-binding RS-W1218
Anti-pattern
Minor
a year agoa year old
Found redundant pattern match, prefer matches!(..) instead
 88        let Some((ip, instruction)) = instructions.next() else {
 89            break;
 90        };
 91        if let InstructionKind::Keyword(Keyword::Include) = instruction.kind { 92            inst_to_remove.push(ip);
 93
 94            let Some((ip, include)) = instructions.next() else {
Found redundant pattern match, prefer matches!(..) instead
530                            });
531                        }
532                        snapshots.push((stack.clone(), Keyword::Do { end_ip: 0 }));
533                    } else if let Keyword::If { .. } | Keyword::Elif { .. } = op_type {534                        snapshots.push((stack.clone(), Keyword::Do { end_ip: 0 }));
535                    } else {
536                        return Err(TypecheckError(InvalidLoop)).with_context(|| {
Found redundant pattern match, prefer matches!(..) instead
616                        .pop()
617                        .ok_or(TypecheckError(InvalidEnd))
618                        .with_context(|| format!("Invalid end: No stack snapshot available"))?;
619                    if let Keyword::Do { .. } = op_type {620                        if stack != expected_stack {
621                            return Err(TypecheckError(InvalidEnd)).with_context(|| {
622                                format!(
Found redundant pattern match, prefer matches!(..) instead
634                                )
635                            });
636                        }
637                    } else if let Keyword::Else { .. } = op_type {638                        if stack != expected_stack {
639                            return Err(TypecheckError(InvalidEnd)).with_context(|| {
640                                format!(
Found redundant pattern match, prefer matches!(..) instead
520                        .pop()
521                        .ok_or(TypecheckError(InvalidLoop))
522                        .with_context(|| format!("Invalid do: No stack snapshot available"))?;
523                    if let Keyword::While { .. } = op_type {524                        if stack != stack_snapshot {
525                            return Err(TypecheckError(InvalidLoop)).with_context(|| {
526                                format!(