File tree Expand file tree Collapse file tree 4 files changed +9
-17
lines changed Expand file tree Collapse file tree 4 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -5436,14 +5436,15 @@ match 2:
54365436 print("it's one")
54375437"#
54385438 ) ,
5439- @r"
5440- success: true
5441- exit_code: 0
5439+ @r### "
5440+ success: false
5441+ exit_code: 1
54425442 ----- stdout -----
5443- All checks passed!
5443+ test.py:2:1: SyntaxError: Cannot use `match` statement on Python 3.9 (syntax was added in Python 3.10)
5444+ Found 1 error.
54445445
54455446 ----- stderr -----
5446- "
5447+ "###
54475448 ) ;
54485449
54495450 // syntax error on 3.9 with preview
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ use crate::fix::{FixResult, fix_file};
3030use crate :: message:: Message ;
3131use crate :: noqa:: add_noqa;
3232use crate :: package:: PackageRoot ;
33- use crate :: preview:: { is_py314_support_enabled, is_unsupported_syntax_enabled } ;
33+ use crate :: preview:: is_py314_support_enabled;
3434use crate :: registry:: { AsRule , Rule , RuleSet } ;
3535#[ cfg( any( feature = "test-rules" , test) ) ]
3636use crate :: rules:: ruff:: rules:: test_rules:: { self , TEST_RULES , TestRule } ;
@@ -447,11 +447,7 @@ pub fn check_path(
447447 }
448448 }
449449
450- let syntax_errors = if is_unsupported_syntax_enabled ( settings) {
451- parsed. unsupported_syntax_errors ( )
452- } else {
453- & [ ]
454- } ;
450+ let syntax_errors = parsed. unsupported_syntax_errors ( ) ;
455451
456452 diagnostics_to_messages (
457453 diagnostics,
Original file line number Diff line number Diff line change @@ -13,11 +13,6 @@ pub(crate) const fn is_semantic_errors_enabled(settings: &LinterSettings) -> boo
1313 settings. preview . is_enabled ( )
1414}
1515
16- // https://github.com/astral-sh/ruff/pull/16429
17- pub ( crate ) const fn is_unsupported_syntax_enabled ( settings : & LinterSettings ) -> bool {
18- settings. preview . is_enabled ( )
19- }
20-
2116pub ( crate ) const fn is_py314_support_enabled ( settings : & LinterSettings ) -> bool {
2217 settings. preview . is_enabled ( )
2318}
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ fn syntax_error() {
6565fn unsupported_syntax_error ( ) {
6666 check ! (
6767 "match 2:\n case 1: ..." ,
68- r#"{"preview": true, " target-version": "py39"}"# ,
68+ r#"{"target-version": "py39"}"# ,
6969 [ ExpandedMessage {
7070 code: None ,
7171 message: "SyntaxError: Cannot use `match` statement on Python 3.9 (syntax was added in Python 3.10)" . to_string( ) ,
You can’t perform that action at this time.
0 commit comments