@@ -140,7 +140,7 @@ impl<'k> Env<'k> {
140
140
} ) ;
141
141
} else {
142
142
return Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
143
- name : chalk_ir:: TypeName :: FnDef ( id . clone ( ) ) ,
143
+ name : chalk_ir:: TypeName :: FnDef ( * id ) ,
144
144
substitution : chalk_ir:: Substitution :: empty ( interner) ,
145
145
} )
146
146
. intern ( interner)
@@ -158,7 +158,7 @@ impl<'k> Env<'k> {
158
158
} ) ;
159
159
} else {
160
160
return Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
161
- name : chalk_ir:: TypeName :: Closure ( id . clone ( ) ) ,
161
+ name : chalk_ir:: TypeName :: Closure ( * id ) ,
162
162
// See note in `program`. Unlike rustc, we store upvars separately.
163
163
substitution : chalk_ir:: Substitution :: empty ( interner) ,
164
164
} )
@@ -526,7 +526,7 @@ impl LowerProgram for Program {
526
526
trait_id : TraitId ( raw_id) ,
527
527
id : lookup. id ,
528
528
name : assoc_ty_defn. name . str . clone ( ) ,
529
- binders : binders ,
529
+ binders,
530
530
} ) ,
531
531
) ;
532
532
}
@@ -1418,10 +1418,10 @@ trait LowerQuantifiedInlineBoundVec {
1418
1418
impl LowerQuantifiedInlineBoundVec for [ QuantifiedInlineBound ] {
1419
1419
fn lower ( & self , env : & Env ) -> LowerResult < Vec < rust_ir:: QuantifiedInlineBound < ChalkIr > > > {
1420
1420
fn trait_identifier ( bound : & InlineBound ) -> & Identifier {
1421
- return match bound {
1421
+ match bound {
1422
1422
InlineBound :: TraitBound ( tb) => & tb. trait_name ,
1423
1423
InlineBound :: AliasEqBound ( ab) => & ab. trait_bound . trait_name ,
1424
- } ;
1424
+ }
1425
1425
}
1426
1426
1427
1427
let mut regular_traits = Vec :: new ( ) ;
@@ -1505,10 +1505,7 @@ impl LowerProjectionTy for ProjectionTy {
1505
1505
trait_id,
1506
1506
substitution : trait_substitution,
1507
1507
} = trait_ref. lower ( env) ?;
1508
- let lookup = match env
1509
- . associated_ty_lookups
1510
- . get ( & ( trait_id. into ( ) , name. str . clone ( ) ) )
1511
- {
1508
+ let lookup = match env. associated_ty_lookups . get ( & ( trait_id, name. str . clone ( ) ) ) {
1512
1509
Some ( lookup) => lookup,
1513
1510
None => Err ( RustIrError :: MissingAssociatedType ( self . name . clone ( ) ) ) ?,
1514
1511
} ;
@@ -1681,7 +1678,7 @@ impl LowerTy for Ty {
1681
1678
. intern ( interner) ) ,
1682
1679
1683
1680
Ty :: Scalar { ty } => Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
1684
- name : chalk_ir:: TypeName :: Scalar ( ast_scalar_to_chalk_scalar ( ty . clone ( ) ) ) ,
1681
+ name : chalk_ir:: TypeName :: Scalar ( ast_scalar_to_chalk_scalar ( * ty ) ) ,
1685
1682
substitution : chalk_ir:: Substitution :: empty ( interner) ,
1686
1683
} )
1687
1684
. intern ( interner) ) ,
@@ -1708,9 +1705,7 @@ impl LowerTy for Ty {
1708
1705
. intern ( interner) ) ,
1709
1706
1710
1707
Ty :: Raw { mutability, ty } => Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
1711
- name : chalk_ir:: TypeName :: Raw ( ast_mutability_to_chalk_mutability (
1712
- mutability. clone ( ) ,
1713
- ) ) ,
1708
+ name : chalk_ir:: TypeName :: Raw ( ast_mutability_to_chalk_mutability ( * mutability) ) ,
1714
1709
substitution : chalk_ir:: Substitution :: from_fallible (
1715
1710
interner,
1716
1711
std:: iter:: once ( Ok ( ty. lower ( env) ?) ) ,
@@ -1723,9 +1718,7 @@ impl LowerTy for Ty {
1723
1718
lifetime,
1724
1719
ty,
1725
1720
} => Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
1726
- name : chalk_ir:: TypeName :: Ref ( ast_mutability_to_chalk_mutability (
1727
- mutability. clone ( ) ,
1728
- ) ) ,
1721
+ name : chalk_ir:: TypeName :: Ref ( ast_mutability_to_chalk_mutability ( * mutability) ) ,
1729
1722
substitution : chalk_ir:: Substitution :: from_iter (
1730
1723
interner,
1731
1724
& [
@@ -1772,9 +1765,7 @@ impl LowerConst for Const {
1772
1765
}
1773
1766
Const :: Value ( value) => Ok ( chalk_ir:: ConstData {
1774
1767
ty : get_type_of_u32 ( ) ,
1775
- value : chalk_ir:: ConstValue :: Concrete ( chalk_ir:: ConcreteConst {
1776
- interned : value. clone ( ) ,
1777
- } ) ,
1768
+ value : chalk_ir:: ConstValue :: Concrete ( chalk_ir:: ConcreteConst { interned : * value } ) ,
1778
1769
}
1779
1770
. intern ( interner) ) ,
1780
1771
}
@@ -1807,14 +1798,13 @@ impl LowerLifetime for Lifetime {
1807
1798
match self {
1808
1799
Lifetime :: Id { name } => {
1809
1800
let parameter = env. lookup_generic_arg ( & name) ?;
1810
- parameter
1811
- . lifetime ( interner)
1812
- . map ( |l| l. clone ( ) )
1813
- . ok_or_else ( || RustIrError :: IncorrectParameterKind {
1801
+ parameter. lifetime ( interner) . copied ( ) . ok_or_else ( || {
1802
+ RustIrError :: IncorrectParameterKind {
1814
1803
identifier : name. clone ( ) ,
1815
1804
expected : Kind :: Lifetime ,
1816
1805
actual : parameter. kind ( ) ,
1817
- } )
1806
+ }
1807
+ } )
1818
1808
}
1819
1809
}
1820
1810
}
@@ -1957,7 +1947,7 @@ impl LowerTrait for TraitDefn {
1957
1947
1958
1948
let trait_datum = rust_ir:: TraitDatum {
1959
1949
id : trait_id,
1960
- binders : binders ,
1950
+ binders,
1961
1951
flags : self . flags . lower ( ) ,
1962
1952
associated_ty_ids,
1963
1953
well_known : self . well_known . map ( |t| t. lower ( ) ) ,
@@ -2038,7 +2028,7 @@ impl<'k> LowerGoal<Env<'k>> for Goal {
2038
2028
// in the assumptions of an `if` goal, e.g. `if (T: Trait) { ... }` lowers to
2039
2029
// `if (FromEnv(T: Trait)) { ... /* this part is untouched */ ... }`.
2040
2030
let where_clauses = hyp
2041
- . into_iter ( )
2031
+ . iter ( )
2042
2032
. flat_map ( |h| h. lower_clause ( env) . apply_result ( ) )
2043
2033
. map ( |result| result. map ( |h| h. into_from_env_clause ( interner) ) ) ;
2044
2034
let where_clauses =
0 commit comments