fix some tidy complaints
This commit is contained in:
parent
24ee4b1f6c
commit
0d51e80b6d
@ -56,13 +56,14 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
|||||||
|
|
||||||
/// Tries to simplify `match_pair`, returning true if
|
/// Tries to simplify `match_pair`, returning true if
|
||||||
/// successful. If successful, new match pairs and bindings will
|
/// successful. If successful, new match pairs and bindings will
|
||||||
/// have been pushed into the candidate. On failure (if false is
|
/// have been pushed into the candidate. If no simplification is
|
||||||
/// returned), no changes are made to candidate.
|
/// possible, Err is returned and no changes are made to
|
||||||
|
/// candidate.
|
||||||
fn simplify_match_pair(&mut self,
|
fn simplify_match_pair(&mut self,
|
||||||
mut block: BasicBlock,
|
mut block: BasicBlock,
|
||||||
match_pair: MatchPair<'tcx>,
|
match_pair: MatchPair<'tcx>,
|
||||||
candidate: &mut Candidate<'tcx>)
|
candidate: &mut Candidate<'tcx>)
|
||||||
-> Result<BasicBlock, MatchPair<'tcx>> // returns Err() if cannot simplify
|
-> Result<BasicBlock, MatchPair<'tcx>>
|
||||||
{
|
{
|
||||||
match match_pair.pattern.kind {
|
match match_pair.pattern.kind {
|
||||||
PatternKind::Wild(..) => {
|
PatternKind::Wild(..) => {
|
||||||
|
@ -27,7 +27,8 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
|||||||
.collect()
|
.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);
|
let pattern = self.hir.mirror(pattern);
|
||||||
MatchPair::new(lvalue, pattern)
|
MatchPair::new(lvalue, pattern)
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,9 @@ pub enum PatternKind<'tcx> {
|
|||||||
subpattern: Option<PatternRef<'tcx>> },
|
subpattern: Option<PatternRef<'tcx>> },
|
||||||
|
|
||||||
// Foo(...) or Foo{...} or Foo, where `Foo` is a variant name from an adt with >1 variants
|
// 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
|
// (...), Foo(...), Foo{...}, or Foo, where `Foo` is a variant name from an adt with 1 variant
|
||||||
Leaf { subpatterns: Vec<FieldPatternRef<'tcx>> },
|
Leaf { subpatterns: Vec<FieldPatternRef<'tcx>> },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user