Fix FP in `to_string_in_display`
Don't emit a lint when `.to_string()` on anything that is not `self`
Fix#5967
changelog: Fix FP in `to_string_in_display` when calling `.to_string()` on anything that is not `self`
Adding new lint to prevent usage of 'unwrap' inside functions that re…
### Change
Adding a new lint that will emit a warning when using "unwrap" or "expect" inside a function that returns result.
### Motivation
These functions promote recoverable errors to non-recoverable errors which may be undesirable in code bases which wish to avoid panics.
### Test plan
Running:
`TESTNAME=unwrap_in_result cargo uitest
`---
changelog: none
Corrects the float_equality_without_abs lint
Fixes an issue in the `float_equality_without_abs` lint. The lint suggestion was configured in a way that it lints the whole error and not just the subtraction part. In the current configuration the lint would suggest to change the expression in a wrong way, e.g.
```rust
let _ = (a - b) < f32::EPSILON; // before
let _ = (a - b).abs(); // after
```
This was dicovered by @flip1995. (See discussion of PR #5952).
Also the suggestion is now formatted via `utils::sugg`.
changelog: none
Fix `let_and_return` bad suggestion
Add a cast to the suggestion when the return expression has adjustments.
These adjustments are lost when the suggestion is applied.
This is similar to the problem in issue #4437.
Closes#5729
changelog: Fix `let_and_return` bad suggestion
Fix fp in `borrow_interior_mutable_const`
fixes#5796
changelog: fix false positive in `borrow_interior_mutable_const` when referencing a field behind a pointer.
Fix incorrect suggestion when `clone_on_ref_ptr` is triggered in macros
In the lint `clone_on_ref_ptr`, if the `span` is in a macro, don't expand it for suggestion.
Fixes: #2076
changelog: none
r? @ebroto
Re-enable len_zero for ranges now that `is_empty` is stable on them
Fixes#5956
Completed stabilization PR: https://github.com/rust-lang/rust/pull/75132
changelog: len_zero: re-enable linting ranges now that range_is_empty is stable
The fmt test will cause clippy dev to be compiled and run. The clippy dev
dependencies are currently stored at `target/debug/deps` when this happens.
This location sometimes causes conflicts with ui tests which result in the
build error "thread 'compile_test' panicked at 'Found multiple rlibs for crate
`regex` ...".
This commit forces the clippy_dev dependencies to be stored under
`clippy_dev/target/` which seems to resolve this problem.
stable_sort_primitive: print the type that is being sorted in the lint message
changelog: stable_sort_primitive: print the type that is being sorted in the lint message
Fix cargo dev new_lint for late lint passes
Since 30c046ede4, `LateLintPass` has only one lifetime parameter.
I'm not sure how to easily test this, I think adding this kind of tests would be probably part of #5394
changelog: none