File tree Expand file tree Collapse file tree 4 files changed +9
-15
lines changed
Expand file tree Collapse file tree 4 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ fn bench_analyze(c: &mut Criterion) {
8383
8484 c. bench_function ( "analyze_files_single_large_file" , |b| {
8585 b. iter ( || {
86- let diags = analyze_files ( black_box ( & [ big_path. clone ( ) ] ) ) . unwrap ( ) ;
86+ let diags = analyze_files ( black_box ( std :: slice :: from_ref ( & big_path) ) ) . unwrap ( ) ;
8787 black_box ( diags) ;
8888 } ) ;
8989 } ) ;
Original file line number Diff line number Diff line change @@ -1063,8 +1063,8 @@ mod tests {
10631063 let src = "if True:\n x = 1\n " ;
10641064 let toks = tokens ( src) ;
10651065 // Should contain: KwIf True : Newline Indent Name Eq Number Newline Dedent Eof
1066- assert ! ( toks. iter ( ) . any ( |t| * t == Token :: Indent ) ) ;
1067- assert ! ( toks. iter ( ) . any ( |t| * t == Token :: Dedent ) ) ;
1066+ assert ! ( toks. contains ( & Token :: Indent ) ) ;
1067+ assert ! ( toks. contains ( & Token :: Dedent ) ) ;
10681068 }
10691069
10701070 #[ test]
Original file line number Diff line number Diff line change @@ -1747,11 +1747,11 @@ mod tests {
17471747 #[ test]
17481748 fn test_walrus_target_collected ( ) {
17491749 let s = stmts ( "def f():\n x = (n := foo())\n " ) ;
1750- if let StmtKind :: FunctionDef ( f) = & s[ 0 ] . kind {
1751- if let StmtKind :: Assign { value, .. } = & f. body [ 0 ] . kind {
1752- let walrus : Vec < & str > = value . walrus . iter ( ) . map ( | ( n , _ ) | * n ) . collect ( ) ;
1753- assert ! ( walrus. contains ( & "n" ) , "walrus target `n` not found" ) ;
1754- }
1750+ if let StmtKind :: FunctionDef ( f) = & s[ 0 ] . kind
1751+ && let StmtKind :: Assign { value, .. } = & f. body [ 0 ] . kind
1752+ {
1753+ let walrus : Vec < & str > = value . walrus . iter ( ) . map ( | ( n , _ ) | * n ) . collect ( ) ;
1754+ assert ! ( walrus . contains ( & "n" ) , "walrus target `n` not found" ) ;
17551755 }
17561756 }
17571757
Original file line number Diff line number Diff line change @@ -592,13 +592,7 @@ mod tests {
592592 out
593593 }
594594
595- fn assigns_and_usages ( src : & str ) -> ( HashMap < String , usize > , HashSet < String > ) {
596- let stmts = parse ( src) ;
597- let mut a = HashMap :: new ( ) ;
598- let mut u = HashSet :: new ( ) ;
599- collect_assigns_and_usages ( & stmts, & mut a, & mut u) ;
600- ( a, u)
601- }
595+
602596
603597 #[ test]
604598 fn test_simple_name_usage ( ) {
You can’t perform that action at this time.
0 commit comments