mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Remove CallArguments
abstraction (#6279)
## Summary This PR removes a now-unnecessary abstraction from `helper.rs` (`CallArguments`), in favor of adding methods to `Arguments` directly, which helps with discoverability.
This commit is contained in:
parent
8a0f844642
commit
041946fb64
13 changed files with 148 additions and 209 deletions
|
@ -1,7 +1,6 @@
|
|||
use ruff_python_ast::{self as ast, Expr, Keyword};
|
||||
|
||||
use ruff_python_ast::call_path::{collect_call_path, from_qualified_name};
|
||||
use ruff_python_ast::helpers::{find_keyword, is_const_true};
|
||||
use ruff_python_ast::helpers::is_const_true;
|
||||
use ruff_python_ast::{self as ast, Arguments, Expr, Keyword};
|
||||
|
||||
use crate::model::SemanticModel;
|
||||
|
||||
|
@ -61,8 +60,8 @@ pub fn is_logger_candidate(
|
|||
|
||||
/// If the keywords to a logging call contain `exc_info=True` or `exc_info=sys.exc_info()`,
|
||||
/// return the `Keyword` for `exc_info`.
|
||||
pub fn exc_info<'a>(keywords: &'a [Keyword], semantic: &SemanticModel) -> Option<&'a Keyword> {
|
||||
let exc_info = find_keyword(keywords, "exc_info")?;
|
||||
pub fn exc_info<'a>(arguments: &'a Arguments, semantic: &SemanticModel) -> Option<&'a Keyword> {
|
||||
let exc_info = arguments.find_keyword("exc_info")?;
|
||||
|
||||
// Ex) `logging.error("...", exc_info=True)`
|
||||
if is_const_true(&exc_info.value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue