/// Tries to simplify `match_pair`, returning true if
/// successful. If successful, new match pairs and bindings will
- /// have been pushed into the candidate. On failure (if false is
- /// returned), no changes are made to candidate.
+ /// have been pushed into the candidate. If no simplification is
+ /// possible, Err is returned and no changes are made to
+ /// candidate.
fn simplify_match_pair(&mut self,
mut block: BasicBlock,
match_pair: MatchPair<'tcx>,
candidate: &mut Candidate<'tcx>)
- -> Result<BasicBlock, MatchPair<'tcx>> // returns Err() if cannot simplify
+ -> Result<BasicBlock, MatchPair<'tcx>>
{
match match_pair.pattern.kind {
PatternKind::Wild(..) => {
.collect()
}
- pub fn match_pair(&mut self, lvalue: Lvalue<'tcx>, pattern: PatternRef<'tcx>) -> MatchPair<'tcx> {
+ pub fn match_pair(&mut self, lvalue: Lvalue<'tcx>, pattern: PatternRef<'tcx>)
+ -> MatchPair<'tcx> {
let pattern = self.hir.mirror(pattern);
MatchPair::new(lvalue, pattern)
}
subpattern: Option<PatternRef<'tcx>> },
// Foo(...) or Foo{...} or Foo, where `Foo` is a variant name from an adt with >1 variants
- Variant { adt_def: AdtDef<'tcx>, variant_index: usize, subpatterns: Vec<FieldPatternRef<'tcx>> },
+ Variant { adt_def: AdtDef<'tcx>,
+ variant_index: usize,
+ subpatterns: Vec<FieldPatternRef<'tcx>> },
// (...), Foo(...), Foo{...}, or Foo, where `Foo` is a variant name from an adt with 1 variant
Leaf { subpatterns: Vec<FieldPatternRef<'tcx>> },