First Pull Request


Lint: Multiple inherent impls rust-lang/rust-clippy

We may want to have a lint that checks for [multiple inherent impls](https://play.rust-lang.org/?gist=5798fd8736e09adb74da&version=stable). Why those are not problematic from a language standpoint,...

Created - 0 comments - E-easy L-lint T-AST

suggest struct constructor instead of mutable object + field mod rust-lang/rust-clippy

If you have a struct where all fields are public, then you should never do `let mut a = A::default(); a.x = 42;` but instead use a constructor with `.. A::default()` at the end: ``` rust #[derive(...

Created - 0 comments - E-easy L-lint T-AST

lint: transmuting known null pointer to ref rust-lang/rust-clippy

`mem::transmute(std::ptr::null())` – this is undefined behavior.

Created - 0 comments - E-easy L-lint T-AST

improve collapsible if in complex cases with same expressions rust-lang/rust-clippy

``` rust if a { if b { f(); } } else { f(); } ``` could be ``` rust if !a || b { f(); } ```

Created - 0 comments - E-easy L-enhancement L-lint

Lint std::panic::catch_unwind rust-lang/rust-clippy

<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place. If you ...

Created - 0 comments - E-easy L-lint T-AST

Lint: Implicit Deref rust-lang/rust-clippy

Basically, an `#[allow]` by default lint that tells you when you are referencing a value implicitly (e.g. `String::new().chars()` is really `(*String::new()).chars()`. Rationale is that somebody o...

Created - 0 comments - E-easy L-lint T-middle

Lint to warn about str::as_ptr() usage in ffi call rust-lang/rust-clippy

Hello. It would be nice to have a warning when using `str::as_ptr()` in a ffi call instead of using `CStr`. For instance, in the following code: ``` rust unsafe { printf("Hello".as_ptr() as *cons...

Created - 0 comments - A-correctness E-easy L-lint T-middle

Calling `main` rust-lang/rust-clippy

Apart from special setups (which we could detect following attributes like `#![no_std]`), recursing into `main()` seems like an unintuitive antipattern we should be able to detect.

Created - 1 comment - C-assigned E-easy L-lint T-AST

lint: `spawn(|| ())` (spawn empty) rust-lang/rust-clippy

Does nothing, can be removed.

Created - 1 comment - E-easy L-lint T-AST

Lint x != _ || x != _ rust-lang/rust-clippy

Also probably `x == _ && x == _`. This is either a duplicate (if both `_` are equal) or always false (true for the former).

Created - 1 comment - A-correctness E-easy L-lint T-middle

lint long chains of into/float additions/multiplications rust-lang/rust-clippy

In generall, `(a+b+c)+(d+e+f)` is faster to compute than `a+b+c+d+e+f`, because the former reduces data dependencies, allowing the CPU to run additions in parallel. For float arithmetic, the tree-l...

Created - 1 comment - A-performance E-easy L-lint T-AST

useless op on lhs of integer division or modulo rust-lang/rust-clippy

`(x + n + y) % n` or `(x + n + y) / n` can simply be replaced by `(x + y) % n` or `(x + y) / n + 1` this isn't true for the following computations on unsigned integers: `(x + n - y) % n` or `...

Created - 1 comment - A-correctness A-unnecessary E-easy L-lint T-middle

Lint `HashMap<T, ZST>` where ZST is any zero sized type rust-lang/rust-clippy

The user should be using `HashSet<T>` instead and magically create the ZSTs out of thin air when needed (since they are all the same value anyway).

Created - 1 comment - A-unnecessary E-easy L-lint T-middle

Lint request: warn mutable range bound variable rust-lang/rust-clippy

Rust uses `..` as the syntactic sugar for range construct however it might be misused as a replacement for *for-loop* in C/C++: the range bounds (`start`/`end`) are captured at the site of the rang...

Created - 1 comment - A-correctness E-easy L-lint T-middle

Lint `as_ref` on `&[u8]` rust-lang/rust-clippy

This is a nop and most likely a remnant of refactoring. Even better would be detecting `as_ref` on `&T` that yields `&T`

Created - 1 comment - A-unnecessary E-easy L-lint T-middle

Lint using |_| () instead of drop rust-lang/rust-clippy

Basically, any occurrence of `|_| ()` as a closure could be more clearly worded as `drop`.

Created - 1 comment - L-lint T-middle good first issue

Lint for Unnecessary Map rust-lang/rust-clippy

It woud be nice if clippy could detect situations where `map()` is being used unnecessarily to pass a contained value wrapped as either a Result or an Option. ### Unnecessarry ``` rust let mut fil...

Created - 2 comments - A-unnecessary E-easy L-lint T-middle

Suggest `v.trailing_zeros() == n` over `(v & (1 << n)) != 0` rust-lang/rust-clippy

What it says in the title. There's probably other similar expressions Rust have nice functions for. See https://stackoverflow.com/questions/39178648/how-to-match-against-a-flags-bitmasks-in-rust.

Created - 2 comments - A-style E-easy L-lint T-middle

Lint unwrap in drop impls rust-lang/rust-clippy

Would it make sense to deny panic-able fns in `Drop::drop` implementations? It recently came up in <https://github.com/diesel-rs/diesel/pull/641#discussion_r100066589>.

Created - 2 comments - A-correctness E-easy E-hard L-lint T-middle

Lint for iterating over a slice with one (or zero) element rust-lang/rust-clippy

<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place. If y...

Created - 2 comments - A-unnecessary E-easy L-lint T-middle

Lint direct calls to `deref` or `deref_mut` rust-lang/rust-clippy

Instead of calling `x.deref()` or `x.deref_mut()`, `&*x` and `&mut *x` should be recommended instead.

Created - 2 comments - A-style E-easy L-lint T-middle

Always true expressions in if expressions rust-lang/rust-clippy

<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place. If y...

Created - 2 comments - A-correctness good first issue hacktoberfest L-lint T-middle

Warn about uses of Rust types where a C (raw) type is expected rust-lang/rust-clippy

I started using Rust on ARMv7 and run twice into issues where Rust types where used instead of `c_*` types. 1. It should not be possible to use a C type in a function declaration and a Rust type...

Created - 2 comments - A-correctness E-hard good first issue hacktoberfest L-lint T-AST

Lint `'static` lifetimes in the type of statics/consts rust-lang/rust-clippy

see https://github.com/rust-lang/rust/pull/41957#discussion_r116365381 for an example RFC 1623 allows writing `const FOO: &str = "bar"` instead of `const FOO: &'static str = "bar"`

Created - 2 comments - E-easy L-lint T-AST

Rust API Guideline: Cargo.toml publishes CI badges for tier 1 platforms rust-lang/rust-clippy

As per [Cargo.toml publishes CI badges for tier 1 platforms](https://github.com/brson/rust-api-guidelines#cargotoml-publishes-ci-badges-for-tier-1-platforms-c-ci).

Created - 2 comments - A-style E-easy L-lint T-cargo

Suggest `x > y` over `x >= y + 1` for integers rust-lang/rust-clippy

Also all other combinations around comparison, and adding/subtracting 1 on either side.

Created - 2 comments - A-style A-unnecessary E-easy L-lint T-middle

Lint calling `mem::swap` on a reference rust-lang/rust-clippy

<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place. If y...

Created - 2 comments - A-correctness C-needs-discussion E-easy L-lint T-middle

Suggest more-accurate float functions for hand-written formulas rust-lang/rust-clippy

Last summer I worked with MATLAB code that was copied-down from equations directly, when floating point math allows for a lot of optimisations that aren't always obvious, like `exp_m1`. Here are a ...

Created - 2 comments - A-performance E-easy E-medium L-lint T-middle

New lint: clone on arguments taken by reference rust-lang/rust-clippy

If a function takes an argument by reference, but later calls `.clone()` on it (or otherwise requires an `impl Clone` or `impl Copy` from it), lint that taking it by ownership allows the caller to ...

Created - 2 comments - A-unnecessary E-easy L-lint T-middle

Displaying issues 1 - 30 of 72 in total

License

Language