@@ -64,19 +64,19 @@ struct MyFlag {
64
64
}
65
65
66
66
impl MyFlag {
67
- fn data_in ( & self , n : i64 ) {
67
+ fn data_in ( self , n : i64 ) {
68
68
sink ( n) ; // $ hasValueFlow=1 hasValueFlow=8
69
69
}
70
70
71
- fn get_data ( & self ) -> i64 {
71
+ fn get_data ( self ) -> i64 {
72
72
if self . flag {
73
73
0
74
74
} else {
75
75
source ( 2 )
76
76
}
77
77
}
78
78
79
- fn data_through ( & self , n : i64 ) -> i64 {
79
+ fn data_through ( self , n : i64 ) -> i64 {
80
80
if self . flag {
81
81
0
82
82
} else {
@@ -107,13 +107,13 @@ fn data_through_method() {
107
107
fn data_in_to_method_called_as_function ( ) {
108
108
let mn = MyFlag { flag : true } ;
109
109
let a = source ( 8 ) ;
110
- MyFlag :: data_in ( & mn, a) ;
110
+ MyFlag :: data_in ( mn, a) ;
111
111
}
112
112
113
113
fn data_through_method_called_as_function ( ) {
114
114
let mn = MyFlag { flag : true } ;
115
115
let a = source ( 12 ) ;
116
- let b = MyFlag :: data_through ( & mn, a) ;
116
+ let b = MyFlag :: data_through ( mn, a) ;
117
117
sink ( b) ; // $ hasValueFlow=12
118
118
}
119
119
@@ -223,29 +223,6 @@ fn test_async_await() {
223
223
futures:: executor:: block_on ( test_async_await_async_part ( ) ) ;
224
224
}
225
225
226
- // Flow out of mutable parameters.
227
-
228
- fn set_int ( n : & mut i64 , c : i64 ) {
229
- * n = c;
230
- }
231
-
232
- fn mutates_argument_1 ( ) {
233
- // Passing an already borrowed value to a function and then reading from the same borrow.
234
- let mut n = 0 ;
235
- let m = & mut n;
236
- sink ( * m) ;
237
- set_int ( m, source ( 37 ) ) ;
238
- sink ( * m) ; // $ hasValueFlow=37
239
- }
240
-
241
- fn mutates_argument_2 ( ) {
242
- // Borrowing at the call and then reading from the unborrowed variable.
243
- let mut n = 0 ;
244
- sink ( n) ;
245
- set_int ( & mut n, source ( 88 ) ) ;
246
- sink ( n) ; // $ MISSING: hasValueFlow=88
247
- }
248
-
249
226
fn main ( ) {
250
227
data_out_of_call ( ) ;
251
228
data_in_to_call ( ) ;
@@ -258,6 +235,4 @@ fn main() {
258
235
259
236
test_operator_overloading ( ) ;
260
237
test_async_await ( ) ;
261
- mutates_argument_1 ( ) ;
262
- mutates_argument_2 ( ) ;
263
238
}
0 commit comments