From 47bbc481b88b73f01034d8475221bf45b69e9d6a Mon Sep 17 00:00:00 2001 From: lubaskin Date: Thu, 18 Dec 2025 21:50:36 +0300 Subject: [PATCH] refactor(blind_except.rs) inline ``Truthiness`` expression --- .../flake8_blind_except/rules/blind_except.rs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs b/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs index 351a33ca0f..a6a3a58425 100644 --- a/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs +++ b/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs @@ -232,11 +232,11 @@ impl<'a> StatementVisitor<'a> for LogExceptionVisitor<'a> { "exception" => true, attr if is_exc_info_compatible_log_method(attr) => { arguments.find_keyword("exc_info").is_some_and(|keyword| { - let truthiness = - Truthiness::from_expr(&keyword.value, |id| { - self.semantic.has_builtin_binding(id) - }); - truthiness.into_bool().unwrap_or(true) // into_bool() can only return None if contained value is Truthiness::Unknown which can be exception object + Truthiness::from_expr(&keyword.value, |id| { + self.semantic.has_builtin_binding(id) + }) + .into_bool() + .unwrap_or(true) // into_bool() can only return None if contained value is Truthiness::Unknown which can be exception object }) } _ => false, @@ -253,11 +253,11 @@ impl<'a> StatementVisitor<'a> for LogExceptionVisitor<'a> { if is_exc_info_compatible_log_method(method) => { arguments.find_keyword("exc_info").is_some_and(|keyword| { - let truthiness = - Truthiness::from_expr(&keyword.value, |id| { - self.semantic.has_builtin_binding(id) - }); - truthiness.into_bool().unwrap_or(true) // into_bool() can only return None if contained value is Truthiness::Unknown which can be exception object + Truthiness::from_expr(&keyword.value, |id| { + self.semantic.has_builtin_binding(id) + }) + .into_bool() + .unwrap_or(true) // into_bool() can only return None if contained value is Truthiness::Unknown which can be exception object }) } _ => false,