From 4099b9610f81432ec8426b31a9454762b1f33284 Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Tue, 14 Nov 2023 18:56:18 +0530 Subject: [PATCH] F-strings doesn't contain bytes literal for `PLW0129` (#8675) For the `PLW0129` rule, the f-string case shouldn't match against bytes literal as f-strings cannot contain them. F-strings are made up of either string literals or formatted expressions. --- .../src/rules/pylint/rules/assert_on_string_literal.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crates/ruff_linter/src/rules/pylint/rules/assert_on_string_literal.rs b/crates/ruff_linter/src/rules/pylint/rules/assert_on_string_literal.rs index d1ebda0237c79..f32bbd98946db 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/assert_on_string_literal.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/assert_on_string_literal.rs @@ -76,7 +76,6 @@ pub(crate) fn assert_on_string_literal(checker: &mut Checker, test: &Expr) { Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) => { value.is_empty() } - Expr::BytesLiteral(ast::ExprBytesLiteral { value, .. }) => value.is_empty(), _ => false, }) { Kind::Empty @@ -84,9 +83,6 @@ pub(crate) fn assert_on_string_literal(checker: &mut Checker, test: &Expr) { Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) => { !value.is_empty() } - Expr::BytesLiteral(ast::ExprBytesLiteral { value, .. }) => { - !value.is_empty() - } _ => false, }) { Kind::NonEmpty