Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Friis Vindum <[email protected]>
  • Loading branch information
hvitved and paldepind committed Dec 18, 2024
1 parent 025a673 commit 3a63dbc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
9 changes: 5 additions & 4 deletions rust/ql/test/library-tests/dataflow/global/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ struct MyInt {
impl Add for MyInt {
type Output = MyInt;

fn add(self, other: MyInt) -> MyInt {
fn add(self, _other: MyInt) -> MyInt {
// Ignore `_other` to get value flow for `self.value`
MyInt { value: self.value }
}
}
Expand All @@ -111,9 +112,9 @@ pub fn test_operator_overloading() {
let c = a + b;
sink(c.value); // $ MISSING: hasValueFlow=5

let a = MyInt { value: source(6) };
let b = MyInt { value: 2 };
let d = b + a;
let a = MyInt { value: 2 };
let b = MyInt { value: source(6) };
let d = a + b;
sink(d.value);

let a = MyInt { value: source(7) };
Expand Down
28 changes: 14 additions & 14 deletions rust/ql/test/library-tests/dataflow/global/viableCallable.expected
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
| main.rs:89:13:89:21 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:90:13:90:30 | mn.data_through(...) | main.rs:66:5:72:5 | fn data_through |
| main.rs:91:5:91:11 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:109:28:109:36 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:112:5:112:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:114:28:114:36 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:117:5:117:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:119:28:119:36 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:121:13:121:20 | a.add(...) | main.rs:103:5:105:5 | fn add |
| main.rs:122:5:122:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:126:5:126:22 | data_out_of_call(...) | main.rs:16:1:19:1 | fn data_out_of_call |
| main.rs:127:5:127:21 | data_in_to_call(...) | main.rs:25:1:28:1 | fn data_in_to_call |
| main.rs:128:5:128:23 | data_through_call(...) | main.rs:34:1:38:1 | fn data_through_call |
| main.rs:130:5:130:24 | data_out_of_method(...) | main.rs:75:1:79:1 | fn data_out_of_method |
| main.rs:131:5:131:28 | data_in_to_method_call(...) | main.rs:81:1:85:1 | fn data_in_to_method_call |
| main.rs:132:5:132:25 | data_through_method(...) | main.rs:87:1:92:1 | fn data_through_method |
| main.rs:134:5:134:31 | test_operator_overloading(...) | main.rs:108:1:123:1 | fn test_operator_overloading |
| main.rs:110:28:110:36 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:113:5:113:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:116:28:116:36 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:118:5:118:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:120:28:120:36 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:122:13:122:20 | a.add(...) | main.rs:103:5:106:5 | fn add |
| main.rs:123:5:123:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:127:5:127:22 | data_out_of_call(...) | main.rs:16:1:19:1 | fn data_out_of_call |
| main.rs:128:5:128:21 | data_in_to_call(...) | main.rs:25:1:28:1 | fn data_in_to_call |
| main.rs:129:5:129:23 | data_through_call(...) | main.rs:34:1:38:1 | fn data_through_call |
| main.rs:131:5:131:24 | data_out_of_method(...) | main.rs:75:1:79:1 | fn data_out_of_method |
| main.rs:132:5:132:28 | data_in_to_method_call(...) | main.rs:81:1:85:1 | fn data_in_to_method_call |
| main.rs:133:5:133:25 | data_through_method(...) | main.rs:87:1:92:1 | fn data_through_method |
| main.rs:135:5:135:31 | test_operator_overloading(...) | main.rs:109:1:124:1 | fn test_operator_overloading |

0 comments on commit 3a63dbc

Please sign in to comment.