@@ -7,16 +7,12 @@ use ruff_text_size::Ranged;
77
88use crate :: Locator ;
99use crate :: checkers:: ast:: Checker ;
10- use crate :: preview:: is_raise_exception_byte_string_enabled;
1110use crate :: registry:: Rule ;
1211use crate :: { Edit , Fix , FixAvailability , Violation } ;
1312
1413/// ## What it does
1514/// Checks for the use of string literals in exception constructors.
1615///
17- /// In [preview], this rule checks for byte string literals in
18- /// exception constructors.
19- ///
2016/// ## Why is this bad?
2117/// Python includes the `raise` in the default traceback (and formatters
2218/// like Rich and IPython do too).
@@ -51,8 +47,6 @@ use crate::{Edit, Fix, FixAvailability, Violation};
5147/// raise RuntimeError(msg)
5248/// RuntimeError: 'Some value' is incorrect
5349/// ```
54- ///
55- /// [preview]: https://docs.astral.sh/ruff/preview/
5650#[ derive( ViolationMetadata ) ]
5751pub ( crate ) struct RawStringInException ;
5852
@@ -218,9 +212,7 @@ pub(crate) fn string_in_exception(checker: &Checker, stmt: &Stmt, exc: &Expr) {
218212 // Check for byte string literals.
219213 Expr :: BytesLiteral ( ast:: ExprBytesLiteral { value : bytes, .. } ) => {
220214 if checker. settings ( ) . rules . enabled ( Rule :: RawStringInException ) {
221- if bytes. len ( ) >= checker. settings ( ) . flake8_errmsg . max_string_length
222- && is_raise_exception_byte_string_enabled ( checker. settings ( ) )
223- {
215+ if bytes. len ( ) >= checker. settings ( ) . flake8_errmsg . max_string_length {
224216 let mut diagnostic =
225217 checker. report_diagnostic ( RawStringInException , first. range ( ) ) ;
226218 if let Some ( indentation) = whitespace:: indentation ( checker. source ( ) , stmt) {
0 commit comments