@@ -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
}
@@ -1416,10 +1416,10 @@ trait LowerQuantifiedInlineBoundVec {
1416
1416
impl LowerQuantifiedInlineBoundVec for [ QuantifiedInlineBound ] {
1417
1417
fn lower ( & self , env : & Env ) -> LowerResult < Vec < rust_ir:: QuantifiedInlineBound < ChalkIr > > > {
1418
1418
fn trait_identifier ( bound : & InlineBound ) -> & Identifier {
1419
- return match bound {
1419
+ match bound {
1420
1420
InlineBound :: TraitBound ( tb) => & tb. trait_name ,
1421
1421
InlineBound :: AliasEqBound ( ab) => & ab. trait_bound . trait_name ,
1422
- } ;
1422
+ }
1423
1423
}
1424
1424
1425
1425
let mut regular_traits = Vec :: new ( ) ;
@@ -1503,10 +1503,7 @@ impl LowerProjectionTy for ProjectionTy {
1503
1503
trait_id,
1504
1504
substitution : trait_substitution,
1505
1505
} = trait_ref. lower ( env) ?;
1506
- let lookup = match env
1507
- . associated_ty_lookups
1508
- . get ( & ( trait_id. into ( ) , name. str . clone ( ) ) )
1509
- {
1506
+ let lookup = match env. associated_ty_lookups . get ( & ( trait_id, name. str . clone ( ) ) ) {
1510
1507
Some ( lookup) => lookup,
1511
1508
None => Err ( RustIrError :: MissingAssociatedType ( self . name . clone ( ) ) ) ?,
1512
1509
} ;
@@ -1673,7 +1670,7 @@ impl LowerTy for Ty {
1673
1670
. intern ( interner) ) ,
1674
1671
1675
1672
Ty :: Scalar { ty } => Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
1676
- name : chalk_ir:: TypeName :: Scalar ( ast_scalar_to_chalk_scalar ( ty . clone ( ) ) ) ,
1673
+ name : chalk_ir:: TypeName :: Scalar ( ast_scalar_to_chalk_scalar ( * ty ) ) ,
1677
1674
substitution : chalk_ir:: Substitution :: empty ( interner) ,
1678
1675
} )
1679
1676
. intern ( interner) ) ,
@@ -1700,9 +1697,7 @@ impl LowerTy for Ty {
1700
1697
. intern ( interner) ) ,
1701
1698
1702
1699
Ty :: Raw { mutability, ty } => Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
1703
- name : chalk_ir:: TypeName :: Raw ( ast_mutability_to_chalk_mutability (
1704
- mutability. clone ( ) ,
1705
- ) ) ,
1700
+ name : chalk_ir:: TypeName :: Raw ( ast_mutability_to_chalk_mutability ( * mutability) ) ,
1706
1701
substitution : chalk_ir:: Substitution :: from_fallible (
1707
1702
interner,
1708
1703
std:: iter:: once ( Ok ( ty. lower ( env) ?) ) ,
@@ -1715,9 +1710,7 @@ impl LowerTy for Ty {
1715
1710
lifetime,
1716
1711
ty,
1717
1712
} => Ok ( chalk_ir:: TyData :: Apply ( chalk_ir:: ApplicationTy {
1718
- name : chalk_ir:: TypeName :: Ref ( ast_mutability_to_chalk_mutability (
1719
- mutability. clone ( ) ,
1720
- ) ) ,
1713
+ name : chalk_ir:: TypeName :: Ref ( ast_mutability_to_chalk_mutability ( * mutability) ) ,
1721
1714
substitution : chalk_ir:: Substitution :: from_iter (
1722
1715
interner,
1723
1716
& [
@@ -1764,9 +1757,7 @@ impl LowerConst for Const {
1764
1757
}
1765
1758
Const :: Value ( value) => Ok ( chalk_ir:: ConstData {
1766
1759
ty : get_type_of_u32 ( ) ,
1767
- value : chalk_ir:: ConstValue :: Concrete ( chalk_ir:: ConcreteConst {
1768
- interned : value. clone ( ) ,
1769
- } ) ,
1760
+ value : chalk_ir:: ConstValue :: Concrete ( chalk_ir:: ConcreteConst { interned : * value } ) ,
1770
1761
}
1771
1762
. intern ( interner) ) ,
1772
1763
}
@@ -1799,14 +1790,13 @@ impl LowerLifetime for Lifetime {
1799
1790
match self {
1800
1791
Lifetime :: Id { name } => {
1801
1792
let parameter = env. lookup_generic_arg ( & name) ?;
1802
- parameter
1803
- . lifetime ( interner)
1804
- . map ( |l| l. clone ( ) )
1805
- . ok_or_else ( || RustIrError :: IncorrectParameterKind {
1793
+ parameter. lifetime ( interner) . copied ( ) . ok_or_else ( || {
1794
+ RustIrError :: IncorrectParameterKind {
1806
1795
identifier : name. clone ( ) ,
1807
1796
expected : Kind :: Lifetime ,
1808
1797
actual : parameter. kind ( ) ,
1809
- } )
1798
+ }
1799
+ } )
1810
1800
}
1811
1801
}
1812
1802
}
@@ -1949,7 +1939,7 @@ impl LowerTrait for TraitDefn {
1949
1939
1950
1940
let trait_datum = rust_ir:: TraitDatum {
1951
1941
id : trait_id,
1952
- binders : binders ,
1942
+ binders,
1953
1943
flags : self . flags . lower ( ) ,
1954
1944
associated_ty_ids,
1955
1945
well_known : self . well_known . map ( |t| t. lower ( ) ) ,
@@ -2030,7 +2020,7 @@ impl<'k> LowerGoal<Env<'k>> for Goal {
2030
2020
// in the assumptions of an `if` goal, e.g. `if (T: Trait) { ... }` lowers to
2031
2021
// `if (FromEnv(T: Trait)) { ... /* this part is untouched */ ... }`.
2032
2022
let where_clauses = hyp
2033
- . into_iter ( )
2023
+ . iter ( )
2034
2024
. flat_map ( |h| h. lower_clause ( env) . apply_result ( ) )
2035
2025
. map ( |result| result. map ( |h| h. into_from_env_clause ( interner) ) ) ;
2036
2026
let where_clauses =
0 commit comments