Skip to content
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

Migrate to span_clippy_lint #7797

Open
3 tasks
camsteffen opened this issue Oct 9, 2021 · 1 comment
Open
3 tasks

Migrate to span_clippy_lint #7797

camsteffen opened this issue Oct 9, 2021 · 1 comment
Assignees
Labels
C-tracking-issue Category: Tracking Issue performance-project For issues and PRs related to the Clippy Performance Project

Comments

@camsteffen
Copy link
Contributor

camsteffen commented Oct 9, 2021

We have a handful of utils for emitting lints: span_lint, span_lint_and_help, etc. We'd like to replace these with one new util named span_clippy_lint. It was already implemented in #7668, but not yet merged.

Goals

  • Be more consistent with rustc
  • Potentially improve perf since allowed lints stop before computing output messages
  • Enable trimmed paths (Enable trimmed paths #7798)

Question: Should we use .emit() like rustc, or use Drop to emit automatically?

Steps

  • Add span_clippy_lint from Enable trimmed paths #7668 and patch the metadata collector to work with it
  • Change all span_lint_* calls to span_clippy_lint
  • divide this into smaller parts?
  • Remove span_lint* utils and metadata collector support
@xFrednet
Copy link
Member

xFrednet commented Jul 21, 2024

I took a small stab at this and refactored 40 restriction lints in #13136.

Check list
  • absolute_paths
  • alloc_instead_of_core
  • allow_attributes
  • allow_attributes_without_reason
  • arithmetic_side_effects
  • as_conversions
  • as_underscore
  • assertions_on_result_states
  • big_endian_bytes
  • cfg_not_test
  • clone_on_ref_ptr
  • create_dir
  • dbg_macro
  • decimal_literal_representation
  • default_numeric_fallback
  • default_union_representation
  • deref_by_slicing
  • disallowed_script_idents
  • else_if_without_else
  • empty_drop
  • empty_enum_variants_with_brackets
  • empty_structs_with_brackets
  • error_impl_error
  • exhaustive_enums
  • exhaustive_structs
  • exit
  • expect_used
  • field_scoped_visibility_modifiers
  • filetype_is_file
  • float_arithmetic
  • float_cmp_const
  • fn_to_numeric_cast_any
  • format_push_string
  • get_unwrap
  • host_endian_bytes
  • if_then_some_else_none
  • impl_trait_in_params
  • implicit_return
  • indexing_slicing
  • infinite_loop
  • inline_asm_x86_att_syntax
  • inline_asm_x86_intel_syntax
  • integer_division
  • integer_division_remainder_used
  • iter_over_hash_type
  • large_include_file
  • let_underscore_must_use
  • let_underscore_untyped
  • little_endian_bytes
  • lossy_float_literal
  • map_err_ignore
  • mem_forget
  • min_ident_chars
  • missing_assert_message
  • missing_asserts_for_indexing
  • missing_docs_in_private_items
  • missing_inline_in_public_items
  • missing_trait_methods
  • mixed_read_write_in_expression
  • mod_module_files
  • modulo_arithmetic
  • multiple_inherent_impl
  • multiple_unsafe_ops_per_block
  • mutex_atomic
  • needless_raw_strings
  • non_ascii_literal
  • panic
  • panic_in_result_fn
  • partial_pub_fields
  • pattern_type_mismatch
  • print_stderr
  • print_stdout
  • pub_use
  • pub_with_shorthand
  • pub_without_shorthand
  • question_mark_used
  • rc_buffer
  • rc_mutex
  • redundant_type_annotations
  • ref_patterns
  • renamed_function_params
  • rest_pat_in_fully_bound_structs
  • same_name_method
  • self_named_module_files
  • semicolon_inside_block
  • semicolon_outside_block
  • separated_literal_suffix
  • shadow_reuse
  • shadow_same
  • shadow_unrelated
  • single_call_fn
  • single_char_lifetime_names
  • std_instead_of_alloc
  • std_instead_of_core
  • str_to_string
  • string_add
  • string_lit_chars_any
  • string_slice
  • string_to_string
  • suspicious_xor_used_as_pow
  • tests_outside_test_module
  • todo
  • try_err
  • undocumented_unsafe_blocks
  • unimplemented
  • unnecessary_safety_comment
  • unnecessary_safety_doc
  • unnecessary_self_imports
  • unneeded_field_pattern
  • unreachable
  • unseparated_literal_suffix
  • unwrap_in_result
  • unwrap_used
  • use_debug
  • verbose_file_reads
  • wildcard_enum_match_arm

@rustbot claim

bors added a commit that referenced this issue Jul 26, 2024
Make restriction lint's use `span_lint_and_then` (i -> p)

This migrates a few restriction lints to use `span_lint_and_then`. This change is motivated by #7797.

I've also cleaned up some lint message. Mostly minor stuff. For example: suggestions with a longer message than `"try"` now use `SuggestionStyle::ShowAlways`

---

cc: #7797

brother PR of: #13136

changelog: none
bors added a commit that referenced this issue Aug 5, 2024
Make restriction lint's use `span_lint_and_then` (a -> e)

This migrates a few restriction lints to use `span_lint_and_then`. This change is motivated by #7797.

I'm also interested if it will have an impact on performance. With some of these lints, like [`clippy::implicit_return`](https://rust-lang.github.io/rust-clippy/master/index.html#/implicit_return) I expect an impact, as it was previously creating a suggestion **for every implicit return** which is just wild.

I've also cleaned up some lint message. Mostly minor stuff. For example: suggestions with a longer message than `"try"` now use `SuggestionStyle::ShowAlways`

---

`@blyxyas` Could you benchmark this PR? I want to get all the numbers :3

---

This also crashed our new lintcheck CI with the following message:

> Error: $GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 46731k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary

Which is just wild. Like, I've [tested the first 20 lints](https://github.com/xFrednet/rust-clippy/actions/runs/10027528172) and got like four changes and then this. 50 MB of changed lint messages o.O. Looks like I'll create a separate PR to fix that step ^^

---

cc: #7797

changelog: none

r? `@blyxyas`
bors added a commit that referenced this issue Aug 6, 2024
Make restriction lint's use `span_lint_and_then` (q -> w)

This migrates a few restriction lints to use `span_lint_and_then`. This change is motivated by #7797.

I've also cleaned up some lint message. Mostly minor stuff. For example: suggestions with a longer message than `"try"` now use `SuggestionStyle::ShowAlways`

---

cc: #7797

sister PR of: #13136

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: Tracking Issue performance-project For issues and PRs related to the Clippy Performance Project
Projects
None yet
Development

No branches or pull requests

2 participants