rust-bitcoin / rust-bitcoin/rust-bitcoin

Even more clippy lints could be turned on

Open
#3,778 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.7k
Forks
1k
Avg merge
4d 39m
Merged PRs (30d)
86

Description

          > I put them in the `units` manifest.

Sounds good! Let's dig a bit further when we do the second crate to see if we can de-dupe.

Some more lints I think we should add, maybe in a followup:

  • cargo_common_metadata
  • clear_with_drain
  • clone_on_ref_ptr (forces explicit Arc::clone when cloning Arcs, which IMO is good style)
  • collection_is_never_read
  • debug_assert_with_mut_call
  • Maybe decimal_literal_representation ... this e.g. complains if you write 32768 instead of 0x8000.
  • deref_by_slicing
  • equatable_if_let (IMO this is good style, but you may disagree)
  • empty_structs_with_brackets
  • Maybe else_if_without_else ... this isa MISRA C guideline and also I dated a girl a long time ago who told me to do this
  • fallible_impl_from (should lint panics in From, a pet peeve of Kix's)
  • float_arithmetic lints any use of float arithmetic ... maybe have this as warn and whitelist specific modules?
  • fn_to_numeric_cast_any
  • imprecise_flops (improve FP accuracy, though maybe at expense of performance)
  • large_stack_frames (goes with large_stack_array)
  • manual_clamp (goes with other manual_* lints we already have)
  • non_ascii_idents (this is actually a rustc lint now... unsure if it's on by default)
  • Maybe pattern_type_mismatch (this is a personal pet peeve of mine, YMMV)
  • Maybe multiple_inherent_impl and module_name_repetitions .. unsure
  • needless_collect
  • string_add (goes with string_add_assign)
  • std_instead_of_core, std_instead_of_alloc, alloc_instead_of_core which lints imports from too-strong a place
  • significant_drop_tightening (suggests moving mutex drops up) and maybe significant_drop_in_scrutinee (not really sure what this does)i

There is also missing_enforced_import_renames which requires explicit configuration.

There is also arithmetic_side_effects which lints all potentially-panicking arithmetic. Can be configured. May be worth exploring or maybe just way too noisy.

Originally posted by @apoelstra in https://github.com/rust-bitcoin/rust-bitcoin/issues/3704#issuecomment-2541736964

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the units manifest and the repository's existing Clippy lint configuration. Review the listed lints and their configuration needs, then determine which are appropriate for the second crate; done means the selected lints are enabled without unacceptable warnings or noise.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.