File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 toolchain : 1.94.0
2424 components : rustfmt, clippy
2525
26+ - name : Setup nightly Rust for rule-preprocessor clippy
27+ uses : dtolnay/rust-toolchain@master
28+ with :
29+ toolchain : nightly
30+ components : clippy, rustc-dev
31+
2632 - name : Check C++ formatting
2733 run : find cpp2rust tests -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format --dry-run --Werror
2834
3137 cargo fmt --manifest-path rules/Cargo.toml -- --check
3238 cargo fmt --manifest-path rule-preprocessor/Cargo.toml -- --check
3339 cargo fmt --manifest-path libcc2rs/Cargo.toml -- --check
34- find tests -name '*.rs' -print0 | xargs -0 -r rustfmt --check
3540
3641 - name : Check Rust lints
3742 run : |
38- cargo clippy --manifest-path rules/Cargo.toml --all-targets -- -D warnings
39- cargo clippy --manifest-path rule-preprocessor/Cargo.toml --all-targets -- -D warnings
40- cargo clippy --manifest-path libcc2rs/Cargo.toml --all-targets -- -D warnings
43+ cargo clippy --manifest-path rules/Cargo.toml --all-targets -- -D clippy::correctness
44+ cargo +nightly clippy --manifest-path rule-preprocessor/Cargo.toml --all-targets -- -D clippy::correctness
45+ cargo clippy --manifest-path libcc2rs/Cargo.toml --all-targets -- -D clippy::correctness
Original file line number Diff line number Diff line change @@ -435,12 +435,11 @@ impl<'a> FnIrBuilder<'a> {
435435
436436 let mut ctx = FragmentCtx :: new ( self , params, generic_names) ;
437437 for child in stmt_list. syntax ( ) . children_with_tokens ( ) {
438- if let ra_ap_syntax:: NodeOrToken :: Token ( ref t) = child {
439- if ( t. kind ( ) == SyntaxKind :: L_CURLY || t. kind ( ) == SyntaxKind :: R_CURLY )
440- && t. parent ( ) . as_ref ( ) == Some ( stmt_list. syntax ( ) )
441- {
442- continue ;
443- }
438+ if let ra_ap_syntax:: NodeOrToken :: Token ( ref t) = child
439+ && ( t. kind ( ) == SyntaxKind :: L_CURLY || t. kind ( ) == SyntaxKind :: R_CURLY )
440+ && t. parent ( ) . as_ref ( ) == Some ( stmt_list. syntax ( ) )
441+ {
442+ continue ;
444443 }
445444 ctx. visit ( child) ;
446445 }
Original file line number Diff line number Diff line change @@ -14,10 +14,11 @@ fn main() {
1414 // Collect all tgt_*.rs files
1515 let mut files = Vec :: new ( ) ;
1616 visit ( & crate_root, & mut |p| {
17- if let Some ( name) = p. file_name ( ) . and_then ( |s| s. to_str ( ) ) {
18- if name. starts_with ( "tgt_" ) && name. ends_with ( ".rs" ) {
19- files. push ( p. to_path_buf ( ) ) ;
20- }
17+ if let Some ( name) = p. file_name ( ) . and_then ( |s| s. to_str ( ) )
18+ && name. starts_with ( "tgt_" )
19+ && name. ends_with ( ".rs" )
20+ {
21+ files. push ( p. to_path_buf ( ) ) ;
2122 }
2223 } ) ;
2324 files. sort ( ) ;
@@ -41,9 +42,7 @@ fn main() {
4142 . to_string_lossy ( )
4243 . replace ( '\\' , "/" )
4344 . trim_start_matches ( "./" )
44- . replace ( '/' , "_" )
45- . replace ( '.' , "_" )
46- . replace ( '-' , "_" ) ;
45+ . replace ( [ '/' , '.' , '-' ] , "_" ) ;
4746
4847 if let Some ( stripped) = module_name. strip_suffix ( "_rs" ) {
4948 module_name = stripped. to_string ( ) ;
You can’t perform that action at this time.
0 commit comments