Commit Graph

13631 Commits

Author SHA1 Message Date
Jason Newcomb
5cd711b4f1 Add lints drop_non_drop and forget_non_drop 2022-04-04 12:30:09 -04:00
bors
85b88be2a4 Auto merge of #8605 - Jarcho:remove-deps, r=xFrednet
Remove deps

This remove both `regex` and `cargo_metadata` as dependencies making `clippy_dev` compile ~3x faster (~46s -> ~16s locally). `cargo_metadata` was used to extract the `version` field from `Cargo.toml`, which is done trivially without that. `regex` was used to parse `define_clippy_lint` in `update_lints` which is now done using `rustc_lexer`. This isn't any simpler, but it compiles ~15s faster and runs ~3x faster (~2.1s -> ~0.7s locally).

The next biggest offenders to compile times are `clap` and `winapi` on windows. `clap` could be removed, but re-implementing enough is probably more work than it's worth. `winapi` is used by `opener` and `walkdir` so it's stuck there.

changelog: none
2022-04-02 10:42:12 +00:00
bors
baaddf2b84 Auto merge of #8611 - Alexendoo:module-files-relative-paths, r=llogiq
Handle relative paths in module_files lints

The problem being that when clippy is run in the project's directory `lp` would be a relative path, this wasn't caught by the tests as there `lp` is an absolute path. Being a relative path it did not start with `trim_src_path` and so was ignored

Also allowed the removal of some `.to_os_string`/`.to_owned`s

changelog: Fixes [`self_named_module_files`] and [`mod_module_files`] not linting

Fixes #8123, cc `@DevinR528`
2022-04-02 07:06:03 +00:00
Jason Newcomb
ae5af0cd1a Remove cargo_metadata dependency from clippy 2022-04-01 23:18:47 -04:00
Jason Newcomb
7025283f3e Remove cargo_metadata dependency from clippy_dev 2022-04-01 23:18:47 -04:00
Jason Newcomb
b3f8415032 Remove regex dependency from clippy_dev 2022-04-01 23:18:47 -04:00
bors
f6b29923c6 Auto merge of #8616 - pitaj:single_element_loop_arrays, r=llogiq
single_element_loop: handle arrays for Edition2021

changelog: [`single_element_loop`] handle arrays in Edition 2021, handle `.iter_mut()` and `.into_iter()`, and wrap in parens if necessary
2022-04-01 18:45:49 +00:00
Peter Jaszkowiak
3bbb3e3329 single_element_loop: handle arrays for Edition2021
also handle `.iter_mut()`, `.into_iter()`,
and wrapping in parens if necessary
2022-04-01 00:04:19 -06:00
bors
db5739ac55 Auto merge of #8610 - SabrinaJewson:transmute-int-to-char-const, r=xFrednet
Don't warn int-to-char transmutes in const contexts

changelog: Don't warn ``[`transmute_int_to_char`]`` in const contexts

fixes: #8379
2022-03-30 20:23:03 +00:00
SabrinaJewson
d6f05c6a89
Don't warn int-to-char transmutes in const contexts 2022-03-30 18:47:50 +01:00
Alex Macleod
10a6d872d4 Handle relative paths in module_files lints 2022-03-30 18:44:04 +01:00
bors
c0a5693abc Auto merge of #8602 - giraffate:fix_ice_for_iter_overeager_cloned, r=llogiq
Fix ICE for `iter_overeager_cloned`

Fix https://github.com/rust-lang/rust-clippy/issues/8527

changelog: Fix ICE for [`iter_overeager_cloned`]
2022-03-30 17:12:24 +00:00
bors
fe7254ff6f Auto merge of #8576 - smoelius:crate_in_macro_def, r=llogiq
Add `crate_in_macro_def` lint

This PR adds a lint to check for `crate` as opposed to `$crate` used in a macro definition.

I think this can close #4798. That issue focused on the case where the macro author "imports something into said macro."

But I think use of `crate` is likely to be a bug whether it appears in a `use` statement or not. There could be some use case I am failing to see, though. (cc: `@nilscript` `@flip1995)`

changelog: `crate_in_macro_def`
2022-03-30 16:57:24 +00:00
Samuel E. Moelius III
aaf04dc043 Fix error message in crate_in_macro_def.stderr 2022-03-30 12:52:31 -04:00
Samuel E. Moelius III
d6eb82c0a8 Move crate_in_macro_def to suspicious 2022-03-30 12:40:53 -04:00
Samuel Moelius
75dc406e84
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-03-30 12:40:44 -04:00
Samuel Moelius
abc221e7f6
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-03-30 12:40:25 -04:00
Samuel Moelius
9b304533ab
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-03-30 12:40:16 -04:00
bors
df7c253d39 Auto merge of #8597 - giraffate:fix_changelog, r=xFrednet
Fix version in changelog

changelog: none
2022-03-30 16:25:42 +00:00
bors
0031f69999 Auto merge of #8592 - c410-f3r:stuff, r=flip1995
Do not fire `panic` in a constant environment

Let rustc handle panics in constant environments.

Since https://github.com/rust-lang/rust-clippy/issues/8348 I thought that such modification would require a lot of work but thanks to https://github.com/rust-lang/rust-clippy/pull/8588 I now know that it is not the case.

changelog: [`panic`]: No longer lint in constant context. `rustc` already handles this.
2022-03-30 16:04:14 +00:00
bors
e1ddf29ee3 Auto merge of #8586 - pitaj:fix-8378, r=flip1995
specify serde version compatible with codebase

fix #8378

changelog: none
2022-03-30 15:46:48 +00:00
bors
d9819c3b8d Auto merge of #8584 - Alexendoo:map-unit-fn-context, r=Manishearth
Provide suggestion context in map_unit_fn

Fixes #8569

changelog: Fix incorrect suggestion for `option_map_unit_fn` , `result_map_unit_fn`
2022-03-30 15:25:37 +00:00
Takayuki Nakata
c22b7b8814 Fix ICE for iter_overeager_cloned 2022-03-29 21:51:37 +09:00
Takayuki Nakata
e5fa22e350 Fix version in changelog 2022-03-28 21:48:34 +09:00
Samuel E. Moelius III
cb307bbfcd Address review comments 2022-03-28 04:48:12 -04:00
bors
6206086dd5 Auto merge of #8487 - dswij:8478, r=giraffate
[`map_identity`] checks for needless `map_err`

Closes #8478

changelog: [`map_identity`] checks for needless `map_err`
2022-03-28 00:25:45 +00:00
bors
59c0f29916 Auto merge of #8519 - tysg:redundant-modulo, r=giraffate
Check if lhs < rhs in modulos in `identity_op`

Fixes #8508

changelog: [`identity_op`] now checks for modulos, e.g. `1 % 3`
2022-03-28 00:11:32 +00:00
Tianyi Song
52b563b283 Emit lint when rhs is negative 2022-03-27 21:49:38 +08:00
Caio
af8ed04e09 Rustfmt 2022-03-26 15:48:17 -03:00
Caio
c687f6575f Do not fire panic in a constant environment 2022-03-26 15:39:21 -03:00
Peter Jaszkowiak
bca047dcea specify serde version compatible with codebase 2022-03-25 16:39:15 -06:00
Alex Macleod
610db04222 Provide suggestion context in map_unit_fn 2022-03-25 20:47:54 +00:00
bors
8ebe766695 Auto merge of #8582 - xFrednet:0000-changelog-1-60, r=Manishearth
Changelog for Rust 1.60.0 🦀 (Kudos to everyone who contributed!)

As always, I'm impressed by how much stuff happened in just one release. Seriously, kudos to everyone who contributed.

changelog: none
2022-03-25 17:05:05 +00:00
xFrednet
55feb4c4aa
Changelog for Rust 1.60.0 🦀 2022-03-25 17:58:39 +01:00
bors
d0cf3481a8 Auto merge of #8580 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

Nice small sync with only typo fixes

changelog: none
2022-03-24 13:29:13 +00:00
flip1995
c995a8b501
Bump nightly version -> 2022-03-24 2022-03-24 14:22:43 +01:00
flip1995
1147b2c481
Merge remote-tracking branch 'upstream/master' into rustup 2022-03-24 14:22:35 +01:00
Samuel Moelius
86872059ed
Typo 2022-03-24 08:57:08 -04:00
bors
e29b3b55a4 Auto merge of #8579 - yoav-lavi:squashed-master, r=flip1995
`unnecessary_join` lint

changelog: Adds a lint called ``[`unnecessary_join`]`` that detects cases of `.collect::<Vec<String>>.join("")` or `.collect::<Vec<_>>.join("")` on an iterator, suggesting `.collect::<String>()` instead

Fixes: https://github.com/rust-lang/rust-clippy/issues/8570

This is a reopen of https://github.com/rust-lang/rust-clippy/pull/8573

changelog: add lint [`unnecessary_join`]
2022-03-24 12:57:08 +00:00
Yoav Lavi
b60a7fb7b6
unnecessary_join lint 2022-03-24 13:18:18 +01:00
Samuel E. Moelius III
65a26692fd Add crate_in_macro_def lint 2022-03-24 05:08:10 -04:00
bors
f07ee8a998 Auto merge of #8232 - Jarcho:match_same_arm_860, r=xFrednet
`match_same_arms` fix

fixes #860
fixes #1140

changelog: Don't lint `match_same_arms` when an interposing arm's pattern would overlap
2022-03-21 20:42:51 +00:00
bors
4a07662d94 Auto merge of #8561 - FoseFx:use_unwrap_or, r=xFrednet
add `or_then_unwrap`

Closes #8557

changelog: New lint [`or_then_unwrap`]
2022-03-21 20:08:29 +00:00
bors
ff0a3687d8 Auto merge of #8520 - J-ZhengLi:issue8506, r=xFrednet
fix suggestion on `[map_flatten]` being cropped causing possible information loss

fixes #8506

Multi-line suggestion given by the lint is missing its bottom part, which could potentially contains useful information about the fix.

---

changelog: [`map_flatten`]: Long suggestions will now be splitup into two help messages
2022-03-21 19:51:56 +00:00
J-ZhengLi
5b6295d663 allowing [map_flatten] to split long suggestions
add new function `span_lint_and_sugg_` for edges in `clippy_utils::diagnostics`
2022-03-21 14:11:22 +08:00
Max Baumann
765cce11b1
refactor: remove need for MethodCall matching 2022-03-21 00:04:37 +01:00
Max Baumann
4580c8a9b7
refactor: use is_lang_ctor() 2022-03-20 23:54:04 +01:00
Max Baumann
0f83753934
feat: change error message 2022-03-20 23:43:17 +01:00
bors
47b93ea5ef Auto merge of #8559 - pickfire:patch-1, r=xFrednet
Fix typo in bug report

repoduce -> reproduce

---

changelog: none
2022-03-20 22:32:12 +00:00
Max Baumann
20c352a4f6
test: add method chain test 2022-03-19 18:17:43 +01:00