@@ -279,9 +279,7 @@ private module Ast implements AstSig<Location> {
279279 result = parent .( Rust:: TupleStructPat ) .getField ( index )
280280 }
281281
282- AstNode getChild ( AstNode parent , int index ) {
283- result = desugar ( runtimeChild ( parent , index ) )
284- }
282+ AstNode getChild ( AstNode parent , int index ) { result = desugar ( runtimeChild ( parent , index ) ) }
285283
286284 private Callable getEnclosingCallableImpl ( Rust:: AstNode node ) {
287285 exists ( Rust:: AstNode parent | parent = node .getParentNode ( ) |
@@ -302,8 +300,7 @@ private module Ast implements AstSig<Location> {
302300
303301 Callable getEnclosingCallable ( AstNode node ) { result = getEnclosingCallableImpl ( node ) }
304302
305- class Callable extends AstNode instanceof Scope:: CfgScope {
306- }
303+ class Callable extends AstNode instanceof Scope:: CfgScope { }
307304
308305 AstNode callableGetBody ( Callable c ) {
309306 result = c .( Rust:: Callable ) .getBody ( )
@@ -426,8 +423,7 @@ private module Ast implements AstSig<Location> {
426423 BreakStmt ( ) { none ( ) }
427424 }
428425
429- class ContinueStmt extends Stmt instanceof Rust:: ContinueExpr {
430- }
426+ class ContinueStmt extends Stmt instanceof Rust:: ContinueExpr { }
431427
432428 class GotoStmt extends Stmt {
433429 GotoStmt ( ) { none ( ) }
@@ -503,11 +499,9 @@ private module Ast implements AstSig<Location> {
503499 Expr getRightOperand ( ) { result = desugar ( this .( Rust:: BinaryExpr ) .getRhs ( ) ) }
504500 }
505501
506- class LogicalAndExpr extends BinaryExpr instanceof Rust:: LogicalAndExpr {
507- }
502+ class LogicalAndExpr extends BinaryExpr instanceof Rust:: LogicalAndExpr { }
508503
509- class LogicalOrExpr extends BinaryExpr instanceof Rust:: LogicalOrExpr {
510- }
504+ class LogicalOrExpr extends BinaryExpr instanceof Rust:: LogicalOrExpr { }
511505
512506 class NullCoalescingExpr extends BinaryExpr {
513507 NullCoalescingExpr ( ) { none ( ) }
@@ -517,17 +511,13 @@ private module Ast implements AstSig<Location> {
517511 Expr getOperand ( ) { result = desugar ( this .( Rust:: PrefixExpr ) .getExpr ( ) ) }
518512 }
519513
520- class LogicalNotExpr extends UnaryExpr instanceof Rust:: LogicalNotExpr {
521- }
514+ class LogicalNotExpr extends UnaryExpr instanceof Rust:: LogicalNotExpr { }
522515
523- class Assignment extends BinaryExpr instanceof Rust:: AssignmentOperation {
524- }
516+ class Assignment extends BinaryExpr instanceof Rust:: AssignmentOperation { }
525517
526- class AssignExpr extends Assignment instanceof Rust:: AssignmentExpr {
527- }
518+ class AssignExpr extends Assignment instanceof Rust:: AssignmentExpr { }
528519
529- class CompoundAssignment extends Assignment instanceof Rust:: CompoundAssignmentExpr {
530- }
520+ class CompoundAssignment extends Assignment instanceof Rust:: CompoundAssignmentExpr { }
531521
532522 class AssignLogicalAndExpr extends CompoundAssignment {
533523 AssignLogicalAndExpr ( ) { none ( ) }
@@ -608,15 +598,11 @@ private predicate guaranteedMatch(Rust::Pat pat) {
608598private module Input implements InputSig1 , InputSig2 {
609599 private import codeql.util.Void
610600
611- predicate cfgCachedStageRef ( ) {
612- CfgCachedStage:: ref ( )
613- }
601+ predicate cfgCachedStageRef ( ) { CfgCachedStage:: ref ( ) }
614602
615603 private newtype TLabel =
616604 TTarget ( Rust:: Expr target ) or
617- TTargetValue ( Rust:: Expr target , boolean value ) {
618- value = true or value = false
619- }
605+ TTargetValue ( Rust:: Expr target , boolean value ) { value = true or value = false }
620606
621607 class Label extends TLabel {
622608 string toString ( ) {
@@ -804,17 +790,12 @@ private module Input implements InputSig1, InputSig2 {
804790 )
805791 }
806792
807- private predicate isAfterMatch (
808- PreControlFlowNode n , Rust:: AstNode ast , boolean value
809- ) {
810- n .isAfterValue ( Ast:: desugar ( ast ) ,
811- any ( MatchingSuccessor t | t .getValue ( ) = value ) )
793+ private predicate isAfterMatch ( PreControlFlowNode n , Rust:: AstNode ast , boolean value ) {
794+ n .isAfterValue ( Ast:: desugar ( ast ) , any ( MatchingSuccessor t | t .getValue ( ) = value ) )
812795 }
813796
814797 private predicate parameterStep ( PreControlFlowNode n1 , PreControlFlowNode n2 ) {
815- exists ( Rust:: ParamBase p , Ast:: AstNode child |
816- child = Ast:: getChild ( p , _)
817- |
798+ exists ( Rust:: ParamBase p , Ast:: AstNode child | child = Ast:: getChild ( p , _) |
818799 n1 .isBefore ( p ) and n2 .isBefore ( child )
819800 or
820801 p instanceof Rust:: Param and
@@ -864,15 +845,11 @@ private module Input implements InputSig1, InputSig2 {
864845 )
865846 }
866847
867- private predicate matchArmStart (
868- Rust:: MatchExpr match , int index , PreControlFlowNode n
869- ) {
848+ private predicate matchArmStart ( Rust:: MatchExpr match , int index , PreControlFlowNode n ) {
870849 n .isBefore ( Ast:: desugar ( match .getArm ( index ) .getPat ( ) ) )
871850 }
872851
873- private predicate matchArmBodyStart (
874- Rust:: MatchArm arm , PreControlFlowNode n
875- ) {
852+ private predicate matchArmBodyStart ( Rust:: MatchArm arm , PreControlFlowNode n ) {
876853 n .isBefore ( Ast:: desugar ( arm .getGuard ( ) .getCondition ( ) ) )
877854 or
878855 not arm .hasGuard ( ) and n .isBefore ( Ast:: desugar ( arm .getExpr ( ) ) )
@@ -914,9 +891,7 @@ private module Input implements InputSig1, InputSig2 {
914891 )
915892 }
916893
917- private predicate genericPatternStep (
918- Rust:: Pat pat , PreControlFlowNode n1 , PreControlFlowNode n2
919- ) {
894+ private predicate genericPatternStep ( Rust:: Pat pat , PreControlFlowNode n1 , PreControlFlowNode n2 ) {
920895 not pat instanceof Rust:: IdentPat and
921896 not pat instanceof Rust:: LiteralPat and
922897 not pat instanceof Rust:: OrPat and
@@ -981,9 +956,7 @@ private module Input implements InputSig1, InputSig2 {
981956 n1 .isIn ( pat ) and not guaranteedMatch ( pat ) and isAfterMatch ( n2 , pat , false )
982957 }
983958
984- private predicate orPatternStep (
985- Rust:: OrPat pat , PreControlFlowNode n1 , PreControlFlowNode n2
986- ) {
959+ private predicate orPatternStep ( Rust:: OrPat pat , PreControlFlowNode n1 , PreControlFlowNode n2 ) {
987960 n1 .isBefore ( pat ) and n2 .isBefore ( Ast:: desugar ( getRankedPatternChild ( pat , 1 ) ) )
988961 or
989962 exists ( int i , Rust:: Pat child | child = getRankedPatternChild ( pat , i ) |
@@ -1002,13 +975,16 @@ private module Input implements InputSig1, InputSig2 {
1002975
1003976 private predicate patternStep ( PreControlFlowNode n1 , PreControlFlowNode n2 ) {
1004977 exists ( Rust:: Pat pat |
1005- genericPatternStep ( pat , n1 , n2 )
1006- or
1007- literalPatternStep ( pat , n1 , n2 )
1008- or
1009- identPatternStep ( pat , n1 , n2 )
1010- or
1011- orPatternStep ( pat , n1 , n2 )
978+ Ast:: desugar ( pat ) = pat and
979+ (
980+ genericPatternStep ( pat , n1 , n2 )
981+ or
982+ literalPatternStep ( pat , n1 , n2 )
983+ or
984+ identPatternStep ( pat , n1 , n2 )
985+ or
986+ orPatternStep ( pat , n1 , n2 )
987+ )
1012988 )
1013989 }
1014990
@@ -1110,15 +1086,11 @@ private module Input implements InputSig1, InputSig2 {
11101086 always = true
11111087 }
11121088
1113- private predicate targetChild (
1114- Rust:: Expr target , Ast:: AstNode child
1115- ) {
1089+ private predicate targetChild ( Rust:: Expr target , Ast:: AstNode child ) {
11161090 child = Ast:: getChild ( target , _)
11171091 }
11181092
1119- predicate endAbruptCompletion (
1120- Ast:: AstNode ast , PreControlFlowNode n , AbruptCompletion c
1121- ) {
1093+ predicate endAbruptCompletion ( Ast:: AstNode ast , PreControlFlowNode n , AbruptCompletion c ) {
11221094 exists ( Rust:: Expr target |
11231095 targetChild ( target , ast ) and
11241096 c .getSuccessorType ( ) instanceof BreakSuccessor
0 commit comments