+
Skip to content

Prepare for clippy pedantic rules #8201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 17, 2025
Merged

Conversation

gabelluardo
Copy link
Contributor

@gabelluardo gabelluardo commented Jun 16, 2025

Works on #4949

These rules pass without any issues:

  • explicit-iter-loop
  • if-not-else
  • inefficient-to-string
  • manual-let-else
  • manual-string-new
  • match-wildcard-for-single-variants
  • needless-continue
  • redundant_else
  • uninlined-format-args
  • unnested_or_patterns

These rules are skipped because of #6720 (review) :

  • bool_to_int_with_if
  • cloned_instead_of_copied
  • large_stack_arrays
  • map_unwrap_or
  • match_same_arms
  • needless_pass_by_value
  • redundant_closure_for_method_calls
  • return_self_not_must_use
  • semicolon_if_nothing_returned
  • single_match_else
  • unnecessary_wraps
  • used_underscore_binding

I made a bash script for testing each rule without losing my mind on the terminal, I leave it here, I think can be useful:

rules=(
    # skipped rules more investigation needed
    # bool_to_int_with_if
    # cloned_instead_of_copied
    # large_stack_arrays
    # map_unwrap_or
    # match_same_arms
    # needless_pass_by_value
    # redundant_closure_for_method_calls
    # semicolon_if_nothing_returned
    # single_match_else
    # return_self_not_must_use
    # unnecessary_wraps
    # used_underscore_binding

    # these rules needed modifications
    explicit_iter_loop
    if_not_else
    inefficient_to_string
    manual_let_else
    manual_string_new
    match_wildcard_for_single_variants
    needless_continue
    redundant_else
    uninlined_format_args
    unnested_or_patterns

    # these rules pass with no issue
    checked_conversions
    explicit_deref_methods
    explicit_into_iter_loop
    filter_map_next
    flat_map_option
    float_cmp
    from_iter_instead_of_collect
    implicit_clone
    inconsistent_struct_constructor
    invalid_upcast_comparisons
    iter_not_returning_iterator
    large_digit_groups
    large_types_passed_by_value
    linkedlist
    macro_use_imports
    manual_assert
    manual_instant_elapsed
    manual_ok_or
    match_bool
    maybe_infinite_iter
    mismatching_type_param_order
    mut_mut
    naive_bytecount
    needless_bitwise_bool
    needless_for_each
    no_effect_underscore_binding
    range_minus_one
    range_plus_one
    ref_option_ref
    same_functions_in_if_condition
    stable_sort_primitive
    string_add_assign
    unnecessary_box_returns
    unnecessary_join
    unreadable_literal
    unsafe_derive_deserialize
    unused_async
    unused_self
    zero_sized_map_values
)

echo "Running all rules together..."
cargo clippy -- $(printf -- '-Wclippy::%s ' "${rules[@]}")

@gabelluardo gabelluardo changed the title Prepare for clippy pendantic rules Prepare for clippy pedantic rules Jun 16, 2025
@sylvestre
Copy link
Contributor

ok, if you have made a script for this, please do one commit per rule then :)
will be easier to revert a commit in case of issue

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@gabelluardo
Copy link
Contributor Author

I hope it's better now

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

It is, thanks :)

@sylvestre sylvestre merged commit 0e564ea into uutils:main Jun 17, 2025
75 checks passed
@sylvestre
Copy link
Contributor

thanks
could you please enable these rules in clippy by default to make sure we don't regress in the future?
thanks

@gabelluardo
Copy link
Contributor Author

Sure, I will make another pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载