@@ -1577,15 +1577,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1577
1577
// End-user visible description of `lvalue`
1578
1578
fn describe_lvalue ( & self , lvalue : & Lvalue < ' tcx > ) -> String {
1579
1579
let mut buf = String :: new ( ) ;
1580
- self . append_lvalue_to_string ( lvalue, & mut buf, None ) ;
1580
+ self . append_lvalue_to_string ( lvalue, & mut buf, false ) ;
1581
1581
buf
1582
1582
}
1583
1583
1584
1584
// Appends end-user visible description of `lvalue` to `buf`.
1585
1585
fn append_lvalue_to_string ( & self ,
1586
1586
lvalue : & Lvalue < ' tcx > ,
1587
1587
buf : & mut String ,
1588
- autoderef : Option < bool > ) {
1588
+ mut autoderef : bool ) {
1589
1589
match * lvalue {
1590
1590
Lvalue :: Local ( local) => {
1591
1591
self . append_local_to_string ( local, buf, "_" ) ;
@@ -1594,19 +1594,17 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1594
1594
buf. push_str ( & format ! ( "{}" , & self . tcx. item_name( static_. def_id) ) ) ;
1595
1595
}
1596
1596
Lvalue :: Projection ( ref proj) => {
1597
- let mut autoderef = autoderef. unwrap_or ( false ) ;
1598
-
1599
1597
match proj. elem {
1600
1598
ProjectionElem :: Deref => {
1601
1599
if autoderef {
1602
- self . append_lvalue_to_string ( & proj. base , buf, Some ( autoderef) ) ;
1600
+ self . append_lvalue_to_string ( & proj. base , buf, autoderef) ;
1603
1601
} else {
1604
1602
buf. push_str ( & "*" ) ;
1605
- self . append_lvalue_to_string ( & proj. base , buf, Some ( autoderef) ) ;
1603
+ self . append_lvalue_to_string ( & proj. base , buf, autoderef) ;
1606
1604
}
1607
1605
} ,
1608
1606
ProjectionElem :: Downcast ( ..) => {
1609
- self . append_lvalue_to_string ( & proj. base , buf, Some ( autoderef) ) ;
1607
+ self . append_lvalue_to_string ( & proj. base , buf, autoderef) ;
1610
1608
} ,
1611
1609
ProjectionElem :: Field ( field, _ty) => {
1612
1610
autoderef = true ;
@@ -1617,14 +1615,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1617
1615
if is_projection_from_ty_closure {
1618
1616
buf. push_str ( & format ! ( "{}" , field_name) ) ;
1619
1617
} else {
1620
- self . append_lvalue_to_string ( & proj. base , buf, Some ( autoderef) ) ;
1618
+ self . append_lvalue_to_string ( & proj. base , buf, autoderef) ;
1621
1619
buf. push_str ( & format ! ( ".{}" , field_name) ) ;
1622
1620
}
1623
1621
} ,
1624
1622
ProjectionElem :: Index ( index) => {
1625
1623
autoderef = true ;
1626
1624
1627
- self . append_lvalue_to_string ( & proj. base , buf, Some ( autoderef) ) ;
1625
+ self . append_lvalue_to_string ( & proj. base , buf, autoderef) ;
1628
1626
buf. push_str ( "[" ) ;
1629
1627
self . append_local_to_string ( index, buf, ".." ) ;
1630
1628
buf. push_str ( "]" ) ;
@@ -1634,7 +1632,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1634
1632
// Since it isn't possible to borrow an element on a particular index and
1635
1633
// then use another while the borrow is held, don't output indices details
1636
1634
// to avoid confusing the end-user
1637
- self . append_lvalue_to_string ( & proj. base , buf, Some ( autoderef) ) ;
1635
+ self . append_lvalue_to_string ( & proj. base , buf, autoderef) ;
1638
1636
buf. push_str ( & "[..]" ) ;
1639
1637
} ,
1640
1638
} ;
0 commit comments