@@ -718,6 +718,23 @@ fn get_fixed_offset_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr, var:
718
718
}
719
719
}
720
720
721
+ fn fetch_cloned_fixed_offset_var < ' a , ' tcx > (
722
+ cx : & LateContext < ' a , ' tcx > ,
723
+ expr : & Expr ,
724
+ var : ast:: NodeId ,
725
+ ) -> Option < FixedOffsetVar > {
726
+ if_let_chain ! { [
727
+ let ExprMethodCall ( ref method, _, ref args) = expr. node,
728
+ method. name == "clone" ,
729
+ args. len( ) == 1 ,
730
+ let Some ( arg) = args. get( 0 ) ,
731
+ ] , {
732
+ return get_fixed_offset_var( cx, arg, var) ;
733
+ } }
734
+
735
+ get_fixed_offset_var ( cx, expr, var)
736
+ }
737
+
721
738
fn get_indexed_assignments < ' a , ' tcx > (
722
739
cx : & LateContext < ' a , ' tcx > ,
723
740
body : & Expr ,
@@ -729,7 +746,7 @@ fn get_indexed_assignments<'a, 'tcx>(
729
746
var : ast:: NodeId ,
730
747
) -> Option < ( FixedOffsetVar , FixedOffsetVar ) > {
731
748
if let Expr_ :: ExprAssign ( ref lhs, ref rhs) = e. node {
732
- match ( get_fixed_offset_var ( cx, lhs, var) , get_fixed_offset_var ( cx, rhs, var) ) {
749
+ match ( get_fixed_offset_var ( cx, lhs, var) , fetch_cloned_fixed_offset_var ( cx, rhs, var) ) {
733
750
( Some ( offset_left) , Some ( offset_right) ) => Some ( ( offset_left, offset_right) ) ,
734
751
_ => None ,
735
752
}
0 commit comments