Skip to content

Commit

Permalink
Rename round_applicability.rs back to unnecessary_cast_to_int.rs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo authored Dec 21, 2024
1 parent 2fb6b32 commit 60e433c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/ruff_linter/src/rules/ruff/rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ pub(crate) use pytest_raises_ambiguous_pattern::*;
pub(crate) use quadratic_list_summation::*;
pub(crate) use redirected_noqa::*;
pub(crate) use redundant_bool_literal::*;
pub(crate) use round_applicability::*;
pub(crate) use sort_dunder_all::*;
pub(crate) use sort_dunder_slots::*;
pub(crate) use static_key_dict_comprehension::*;
#[cfg(any(feature = "test-rules", test))]
pub(crate) use test_rules::*;
pub(crate) use unnecessary_cast_to_int::*;
pub(crate) use unnecessary_iterable_allocation_for_first_element::*;
pub(crate) use unnecessary_key_check::*;
pub(crate) use unnecessary_nested_literal::*;
Expand Down Expand Up @@ -76,14 +76,14 @@ mod pytest_raises_ambiguous_pattern;
mod quadratic_list_summation;
mod redirected_noqa;
mod redundant_bool_literal;
mod round_applicability;
mod sequence_sorting;
mod sort_dunder_all;
mod sort_dunder_slots;
mod static_key_dict_comprehension;
mod suppression_comment_visitor;
#[cfg(any(feature = "test-rules", test))]
pub(crate) mod test_rules;
mod unnecessary_cast_to_int;
mod unnecessary_iterable_allocation_for_first_element;
mod unnecessary_key_check;
mod unnecessary_nested_literal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ fn unwrap_int_expression(
Fix::applicable_edit(edit, applicability)
}

/// Returns `Some` if `call` in `int(call(..))` is a method that returns an `int` and `None`
/// otherwise.
/// Returns `Some` if `call` in `int(call(...))` is a method that returns an `int`
/// and `None` otherwise.
fn call_applicability(checker: &mut Checker, inner_call: &ExprCall) -> Option<Applicability> {
let (func, arguments) = (&inner_call.func, &inner_call.arguments);

Expand All @@ -116,7 +116,7 @@ fn call_applicability(checker: &mut Checker, inner_call: &ExprCall) -> Option<Ap
}

// Depends on `ndigits` and `number.__round__`
["" | "builtins", "round"] => replace_with_round(checker, arguments),
["" | "builtins", "round"] => round_applicability(checker, arguments),

// Depends on `__ceil__`/`__floor__`/`__trunc__`
["math", "ceil" | "floor" | "trunc"] => Some(Applicability::Unsafe),
Expand Down Expand Up @@ -170,7 +170,7 @@ enum Ndigits {
/// Determines the [`Applicability`] for a `round(..)` call.
///
/// The Applicability depends on the `ndigits` and the number argument.
fn replace_with_round(checker: &Checker, arguments: &Arguments) -> Option<Applicability> {
fn round_applicability(checker: &Checker, arguments: &Arguments) -> Option<Applicability> {
if arguments.len() > 2 {
return None;
}
Expand Down

0 comments on commit 60e433c

Please sign in to comment.