File tree Expand file tree Collapse file tree 8 files changed +92
-0
lines changed
test/query-tests/diagnostics Expand file tree Collapse file tree 8 files changed +92
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @name Extracted files
3+ * @description Lists all files in the source code directory that were extracted.
4+ * @kind diagnostic
5+ * @id rust/diagnostics/successfully-extracted-files
6+ * @tags successfully-extracted-files
7+ */
8+
9+ import rust
10+
11+ from File f
12+ where exists ( f .getRelativePath ( ) )
13+ select f , "File successfully extracted."
Original file line number Diff line number Diff line change 1+ | does_not_compile.rs:0:0:0:0 | does_not_compile.rs | File successfully extracted. |
2+ | error.rs:0:0:0:0 | error.rs | File successfully extracted. |
3+ | lib.rs:0:0:0:0 | lib.rs | File successfully extracted. |
4+ | main.rs:0:0:0:0 | main.rs | File successfully extracted. |
5+ | my_macro.rs:0:0:0:0 | my_macro.rs | File successfully extracted. |
6+ | my_struct.rs:0:0:0:0 | my_struct.rs | File successfully extracted. |
Original file line number Diff line number Diff line change 1+ queries/diagnostics/ExtractedFiles.ql
Original file line number Diff line number Diff line change 1+ pub fn my_func ( ) {
2+ This is not correct Rust code.
3+ }
Original file line number Diff line number Diff line change 1+ pub fn my_func ( ) {
2+ compile_error ! ( "An error!" ) ;
3+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * total lines in this file: 18
3+ * of which code: 7
4+ * of which only comments: 7
5+ * of which blank: 4
6+ */
7+
8+ mod my_struct;
9+ mod my_macro;
10+
11+ // another comment
12+
13+ fn main ( ) {
14+ println ! ( "Hello, world!" ) ; // another comment
15+
16+ my_struct:: my_func ( ) ;
17+ my_macro:: my_func ( ) ;
18+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * total lines in this file: 18
3+ * of which code: 10
4+ * of which only comments: 6
5+ * of which blank: 2
6+ */
7+
8+ macro_rules! myMacro {
9+ ( ) => {
10+ println!( "Hello, world!" ) ;
11+ } ;
12+ }
13+
14+ pub fn my_func ( ) {
15+ if true {
16+ myMacro ! ( ) ;
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ #![ allow( dead_code) ]
2+ /**
3+ * total lines in this file: 30
4+ * of which code: 20
5+ * of which only comments: 6
6+ * of which blank: 4
7+ */
8+
9+ #[ derive( Debug ) ]
10+ struct MyStruct {
11+ name : String ,
12+ value : i32 ,
13+ }
14+
15+ impl MyStruct {
16+ fn my_method ( & self ) {
17+ println ! ( "Hello, world!" ) ;
18+ }
19+ }
20+
21+ pub fn my_func ( ) {
22+ let _a = 1 ;
23+ let b =
24+ MyStruct {
25+ name : String :: from ( "abc" ) ,
26+ value : 123 ,
27+ } ;
28+
29+ b. my_method ( ) ;
30+ }
You can’t perform that action at this time.
0 commit comments