mirror of
https://github.com/astral-sh/ruff.git
synced 2025-12-23 09:19:58 +00:00
refactor(blind_except.rs) inline `Truthiness` expression
This commit is contained in:
parent
b87814973f
commit
47bbc481b8
1 changed files with 10 additions and 10 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue