Skip to content

Commit c381153

Browse files
geoffw0hvitved
andauthored
Apply suggestions from code review
Co-authored-by: Tom Hvitved <[email protected]>
1 parent 8548c16 commit c381153

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

rust/ql/lib/codeql/rust/security/Barriers.qll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ private import codeql.rust.frameworks.stdlib.Builtins
1515
*/
1616
class NumericTypeBarrier extends DataFlow::Node {
1717
NumericTypeBarrier() {
18-
exists(TypeInference::Type t |
18+
exists(StructType t, Struct s |
1919
t = TypeInference::inferType(this.asExpr().getExpr()) and
20-
(
21-
t.(StructType).getStruct() instanceof NumericType or
22-
t.(StructType).getStruct() instanceof Bool
23-
)
20+
s = t.getStruct()
21+
|
22+
s instanceof NumericType or
23+
s instanceof Bool
2424
)
2525
}
2626
}
@@ -31,12 +31,12 @@ class NumericTypeBarrier extends DataFlow::Node {
3131
*/
3232
class IntegralOrBooleanTypeBarrier extends DataFlow::Node {
3333
IntegralOrBooleanTypeBarrier() {
34-
exists(TypeInference::Type t |
34+
exists(StructType t, Struct s |
3535
t = TypeInference::inferType(this.asExpr().getExpr()) and
36-
(
37-
t.(StructType).getStruct() instanceof IntegralType or
38-
t.(StructType).getStruct() instanceof Bool
39-
)
36+
s = t.getStruct()
37+
|
38+
s instanceof IntegralType or
39+
s instanceof Bool
4040
)
4141
}
4242
}

0 commit comments

Comments
 (0)