File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ impl Exit for TsxCode {
156
156
157
157
impl Exit for RustCode {
158
158
fn compute ( node : & Node , stats : & mut Stats ) {
159
- if matches ! ( node. kind_id( ) . into( ) , Rust :: ReturnExpression )
159
+ if matches ! ( node. kind_id( ) . into( ) , Rust :: ReturnExpression | Rust :: QMARK )
160
160
|| Self :: is_func ( node) && node. child_by_field_name ( "return_type" ) . is_some ( )
161
161
{
162
162
stats. exit += 1 ;
@@ -222,6 +222,23 @@ mod tests {
222
222
} ) ;
223
223
}
224
224
225
+ #[ test]
226
+ fn rust_question_mark ( ) {
227
+ check_metrics :: < RustParser > ( "let _ = a? + b? + c?;" , "foo.rs" , |metric| {
228
+ // 0 functions
229
+ insta:: assert_json_snapshot!(
230
+ metric. nexits,
231
+ @r###"
232
+ {
233
+ "sum": 3.0,
234
+ "average": null,
235
+ "min": 3.0,
236
+ "max": 3.0
237
+ }"###
238
+ ) ;
239
+ } ) ;
240
+ }
241
+
225
242
#[ test]
226
243
fn c_no_exit ( ) {
227
244
check_metrics :: < CppParser > ( "int a = 42;" , "foo.c" , |metric| {
You can’t perform that action at this time.
0 commit comments