]>
git.lizzy.rs Git - rust.git/log
Alex Macleod [Wed, 30 Mar 2022 17:44:04 +0000 (18:44 +0100)]
Handle relative paths in module_files lints
bors [Wed, 30 Mar 2022 16:57:24 +0000 (16:57 +0000)]
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`
Samuel E. Moelius III [Wed, 30 Mar 2022 16:52:31 +0000 (12:52 -0400)]
Fix error message in crate_in_macro_def.stderr
Samuel E. Moelius III [Wed, 30 Mar 2022 16:32:07 +0000 (12:32 -0400)]
Move `crate_in_macro_def` to suspicious
Samuel Moelius [Wed, 30 Mar 2022 16:40:44 +0000 (12:40 -0400)]
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
Samuel Moelius [Wed, 30 Mar 2022 16:40:25 +0000 (12:40 -0400)]
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
Samuel Moelius [Wed, 30 Mar 2022 16:40:16 +0000 (12:40 -0400)]
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
bors [Wed, 30 Mar 2022 16:25:42 +0000 (16:25 +0000)]
Auto merge of #8597 - giraffate:fix_changelog, r=xFrednet
Fix version in changelog
changelog: none
bors [Wed, 30 Mar 2022 16:04:14 +0000 (16:04 +0000)]
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.
bors [Wed, 30 Mar 2022 15:46:48 +0000 (15:46 +0000)]
Auto merge of #8586 - pitaj:fix-8378, r=flip1995
specify serde version compatible with codebase
fix #8378
changelog: none
bors [Wed, 30 Mar 2022 15:25:37 +0000 (15:25 +0000)]
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`
Takayuki Nakata [Mon, 28 Mar 2022 12:48:34 +0000 (21:48 +0900)]
Fix version in changelog
Samuel E. Moelius III [Mon, 28 Mar 2022 08:32:31 +0000 (04:32 -0400)]
Address review comments
bors [Mon, 28 Mar 2022 00:25:45 +0000 (00:25 +0000)]
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`
bors [Mon, 28 Mar 2022 00:11:32 +0000 (00:11 +0000)]
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`
Tianyi Song [Sun, 27 Mar 2022 13:48:15 +0000 (21:48 +0800)]
Emit lint when rhs is negative
Caio [Sat, 26 Mar 2022 18:48:17 +0000 (15:48 -0300)]
Rustfmt
Caio [Sat, 26 Mar 2022 18:39:21 +0000 (15:39 -0300)]
Do not fire `panic` in a constant environment
Peter Jaszkowiak [Fri, 25 Mar 2022 22:39:15 +0000 (16:39 -0600)]
specify serde version compatible with codebase
Alex Macleod [Fri, 25 Mar 2022 20:39:03 +0000 (20:39 +0000)]
Provide suggestion context in map_unit_fn
bors [Fri, 25 Mar 2022 17:05:05 +0000 (17:05 +0000)]
Auto merge of #8582 - xFrednet:0000-changelog-1-60, r=Manishearth
Changelog for Rust 1.60.0 :crab: (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
xFrednet [Thu, 24 Mar 2022 23:27:25 +0000 (00:27 +0100)]
Changelog for Rust 1.60.0 :crab:
bors [Thu, 24 Mar 2022 13:29:13 +0000 (13:29 +0000)]
Auto merge of #8580 - flip1995:rustup, r=flip1995
Rustup
r? `@ghost`
Nice small sync with only typo fixes
changelog: none
flip1995 [Thu, 24 Mar 2022 13:22:43 +0000 (14:22 +0100)]
Bump nightly version -> 2022-03-24
flip1995 [Thu, 24 Mar 2022 13:13:37 +0000 (14:13 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup
Samuel Moelius [Thu, 24 Mar 2022 12:57:08 +0000 (08:57 -0400)]
Typo
bors [Thu, 24 Mar 2022 12:57:08 +0000 (12:57 +0000)]
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`]
Yoav Lavi [Thu, 24 Mar 2022 12:18:18 +0000 (13:18 +0100)]
`unnecessary_join` lint
Samuel E. Moelius III [Thu, 24 Mar 2022 01:08:52 +0000 (21:08 -0400)]
Add `crate_in_macro_def` lint
bors [Mon, 21 Mar 2022 20:42:51 +0000 (20:42 +0000)]
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
bors [Mon, 21 Mar 2022 20:08:29 +0000 (20:08 +0000)]
Auto merge of #8561 - FoseFx:use_unwrap_or, r=xFrednet
add `or_then_unwrap`
Closes #8557
changelog: New lint [`or_then_unwrap`]
bors [Mon, 21 Mar 2022 19:51:56 +0000 (19:51 +0000)]
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
J-ZhengLi [Mon, 21 Mar 2022 06:11:22 +0000 (14:11 +0800)]
allowing [`map_flatten`] to split long suggestions
add new function `span_lint_and_sugg_` for edges in `clippy_utils::diagnostics`
Max Baumann [Sun, 20 Mar 2022 23:04:37 +0000 (00:04 +0100)]
refactor: remove need for MethodCall matching
Max Baumann [Sun, 20 Mar 2022 22:54:04 +0000 (23:54 +0100)]
refactor: use is_lang_ctor()
Max Baumann [Sun, 20 Mar 2022 22:43:17 +0000 (23:43 +0100)]
feat: change error message
bors [Sun, 20 Mar 2022 22:32:12 +0000 (22:32 +0000)]
Auto merge of #8559 - pickfire:patch-1, r=xFrednet
Fix typo in bug report
repoduce -> reproduce
---
changelog: none
Max Baumann [Sat, 19 Mar 2022 17:17:43 +0000 (18:17 +0100)]
test: add method chain test
Max Baumann [Fri, 18 Mar 2022 22:18:36 +0000 (23:18 +0100)]
feat: make fixable
Max Baumann [Fri, 18 Mar 2022 21:44:56 +0000 (22:44 +0100)]
feat: use span_lint_and_sugg
Max Baumann [Fri, 18 Mar 2022 20:11:54 +0000 (21:11 +0100)]
refactor: move into methods module
bors [Fri, 18 Mar 2022 15:54:45 +0000 (15:54 +0000)]
Auto merge of #8562 - Jarcho:enum_tuple_variant_as_int, r=Manishearth
Add lint `cast_enum_constructor`
fixes: #1116
changelog: Add lint `cast_enum_constructor`
Max Baumann [Fri, 18 Mar 2022 13:45:48 +0000 (14:45 +0100)]
feat: add comment
bors [Fri, 18 Mar 2022 00:42:18 +0000 (00:42 +0000)]
Auto merge of #8543 - dswij:8393, r=giraffate
`unnecessary_lazy_eval` show suggestions on multiline lint
Closes #8393
changelog: [`unnecessary_lazy_eval`] now shows suggestions for long-line lints
Max Baumann [Fri, 18 Mar 2022 00:12:39 +0000 (01:12 +0100)]
fix: ran update_lints
Max Baumann [Fri, 18 Mar 2022 00:04:33 +0000 (01:04 +0100)]
refactor: rename lint to or_then_unwrap
Jason Newcomb [Thu, 17 Mar 2022 20:04:45 +0000 (16:04 -0400)]
Add lint `cast_enum_constructor`
Max Baumann [Thu, 17 Mar 2022 23:51:26 +0000 (00:51 +0100)]
feat: add tests and fix existing ones
Max Baumann [Thu, 17 Mar 2022 23:34:24 +0000 (00:34 +0100)]
feat: rename variable in example
Max Baumann [Thu, 17 Mar 2022 23:23:55 +0000 (00:23 +0100)]
refactor: use pattern matching for MethodCall arguments
Co-authored-by: xFrednet <xFrednet@gmail.com>
Dylan DPC [Thu, 17 Mar 2022 21:55:05 +0000 (22:55 +0100)]
Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes
Signed-off-by: codehorseman <cricis@yeah.net>
Dylan DPC [Thu, 17 Mar 2022 21:55:02 +0000 (22:55 +0100)]
Rollup merge of #94309 - eholk:issue-57017, r=tmandry
[generator_interior] Be more precise with scopes of borrowed places
Previously the generator interior type checking analysis would use the nearest temporary scope as the scope of a borrowed value. This ends up being overly broad for cases such as:
```rust
fn status(_client_status: &Client) -> i16 {
200
}
fn main() {
let client = Client;
let g = move || match status(&client) {
_status => yield,
};
assert_send(g);
}
```
In this case, the borrow `&client` could be considered in scope for the entirety of the `match` expression, meaning it would be viewed as live across the `yield`, therefore making the generator not `Send`.
In most cases, we want to use the enclosing expression as the scope for a borrowed value which will be less than or equal to the nearest temporary scope. This PR changes the analysis to use the enclosing expression as the scope for most borrows, with the exception of borrowed RValues which are true temporary values that should have the temporary scope. There's one further exception where borrows of a copy such as happens in autoref cases also should be ignored despite being RValues.
Joint work with `@nikomatsakis`
Fixes #57017
r? `@tmandry`
Max Baumann [Thu, 17 Mar 2022 18:52:07 +0000 (19:52 +0100)]
fix: fix clippy_lints
Max Baumann [Thu, 17 Mar 2022 18:29:59 +0000 (19:29 +0100)]
fix: fix broken dogfood tests
Max Baumann [Thu, 17 Mar 2022 18:13:44 +0000 (19:13 +0100)]
fix: fix tests
Max Baumann [Thu, 17 Mar 2022 17:57:28 +0000 (18:57 +0100)]
feat: add use_unwrap_or
bors [Thu, 17 Mar 2022 17:05:26 +0000 (17:05 +0000)]
Auto merge of #8552 - Jarcho:ptr_arg_8495, r=xFrednet
Don't lint `ptr_arg` on `&mut Cow<_>`
fixes: #8495
changelog: Don't lint `ptr_arg` on `&mut Cow<_>`
Ivan Tham [Thu, 17 Mar 2022 14:53:27 +0000 (22:53 +0800)]
Fix typo in bug report
repoduce -> reproduce
dswij [Thu, 17 Mar 2022 06:33:09 +0000 (14:33 +0800)]
Add some comments
Jason Newcomb [Thu, 17 Mar 2022 03:55:38 +0000 (23:55 -0400)]
Fix mixed enum variant kinds + code cleanup
bors [Wed, 16 Mar 2022 19:27:44 +0000 (19:27 +0000)]
Auto merge of #8553 - Jarcho:transmute_undefined_8499, r=llogiq
Don't lint `transmute_undefined_repr` when changing the type of generic params
Partially fixes #8499
changelog: Don't lint `transmute_undefined_repr` when changing the type of generic params
Jason Newcomb [Sat, 22 Jan 2022 02:30:34 +0000 (21:30 -0500)]
Improve message for `match_single_arms`
Jason Newcomb [Thu, 6 Jan 2022 19:54:57 +0000 (14:54 -0500)]
Handle slice patterns in `match_same_arms`
Jason Newcomb [Thu, 6 Jan 2022 18:37:37 +0000 (13:37 -0500)]
Use `DroplessArena` when allocating `ResolvedPat`s
Fix tuple handling in `match_same_arms`
Jason Newcomb [Thu, 6 Jan 2022 07:54:35 +0000 (02:54 -0500)]
Check if there are any overlapping patterns between equal arm bodies in `match_same_arm`
Jason Newcomb [Wed, 16 Mar 2022 16:54:32 +0000 (12:54 -0400)]
Don't lint `transmute_undefined_repr` when changing the type of generic params
Jason Newcomb [Wed, 16 Mar 2022 16:00:27 +0000 (12:00 -0400)]
Don't lint `ptr_arg` on `&mut Cow<_>`
codehorseman [Wed, 16 Mar 2022 12:12:30 +0000 (20:12 +0800)]
resolve the conflict in compiler/rustc_session/src/parse.rs
Signed-off-by: codehorseman <cricis@yeah.net>
bors [Wed, 16 Mar 2022 09:55:39 +0000 (09:55 +0000)]
Auto merge of #8544 - nellorocca:dev/5757, r=flip1995
Moved ``[try_err]`` to restriction
Fixes #5757
changelog: Moved try_err lint to rescrition for #5757
bors [Wed, 16 Mar 2022 09:39:22 +0000 (09:39 +0000)]
Auto merge of #8547 - Jarcho:transmute_8501, r=flip1995
More `transmute_undefined_repr` fixes
fixes: #8498
fixes: #8501
fixes: #8503
changelog: Allow `transumte_undefined_repr` between fat pointers and `(usize, usize)`
changelog: Allow `transumte_undefined_repr` when one side is a union
changelog: Fix `transumte_undefined_repr` on tuples with one non-zero-sized type.
bors [Wed, 16 Mar 2022 06:20:45 +0000 (06:20 +0000)]
Auto merge of #8546 - KisaragiEffective:patch-1, r=llogiq
[`collapsible_if`] fix typo in code-block kind specifier
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: [`collapsible_if`] fix typo in code-block kind specifier
Jason Newcomb [Wed, 16 Mar 2022 02:47:18 +0000 (22:47 -0400)]
Fix checking transmutes with adjusted types
Jason Newcomb [Wed, 16 Mar 2022 02:38:15 +0000 (22:38 -0400)]
Don't lint `transmute_undefined_repr` on unions.
Jason Newcomb [Wed, 16 Mar 2022 02:33:26 +0000 (22:33 -0400)]
Small simplification to `transmute_undefined_repr`
Jason Newcomb [Wed, 16 Mar 2022 02:31:07 +0000 (22:31 -0400)]
Don't lint fat pointer to `(usize, usize)` conversion in `transmute_undefined_repr`
Jason Newcomb [Wed, 16 Mar 2022 01:51:07 +0000 (21:51 -0400)]
Fix `transmute_undefined_repr` for single element tuples
Kisaragi [Wed, 16 Mar 2022 01:19:19 +0000 (10:19 +0900)]
fix typo in code-block kind specifier
Kisaragi [Tue, 15 Mar 2022 23:50:30 +0000 (08:50 +0900)]
fix typo in code-block kind specifier
Paolo Gentili [Tue, 15 Mar 2022 18:38:40 +0000 (19:38 +0100)]
Lint list updated
Paolo Gentili [Tue, 15 Mar 2022 13:24:07 +0000 (14:24 +0100)]
Moved lint to `restriction`
dswij [Tue, 15 Mar 2022 13:29:17 +0000 (21:29 +0800)]
`unnecessary_lazy_eval` show suggestions on multiline lint
bors [Tue, 15 Mar 2022 09:02:38 +0000 (09:02 +0000)]
Auto merge of #8541 - flip1995:iter_with_drain_ambulance, r=giraffate
Move iter_with_drain to nursery
cc #8538 #8539
r? `@giraffate`
changelog: Move [`iter_with_drain`] to nursery
flip1995 [Tue, 15 Mar 2022 08:46:49 +0000 (09:46 +0100)]
Move iter_with_drain to nursery
bors [Tue, 15 Mar 2022 01:08:47 +0000 (01:08 +0000)]
Auto merge of #8509 - smoelius:fix-8507, r=giraffate
Fix `unncessary_to_owned` false positive
Fix #8507
changelog: none
Dylan DPC [Tue, 15 Mar 2022 01:00:08 +0000 (02:00 +0100)]
fix typos
bors [Mon, 14 Mar 2022 23:39:50 +0000 (23:39 +0000)]
Auto merge of #8537 - xFrednet:7923-single-component-path-imports-for-macros, r=llogiq
Allow `single_component_path_imports` for all macros
Closes: https://github.com/rust-lang/rust-clippy/issues/7923
It can be useful to have `use macro_name` regardless of the visibility. This removes the visibility filter.
changelog: [`single_component_path_imports`]: no longer triggers on macros
bors [Mon, 14 Mar 2022 22:12:25 +0000 (22:12 +0000)]
Auto merge of #8536 - xFrednet:8062-applicability-search-is-some, r=camsteffen
Make `search_is_some`s suggestion `MachineApplicable`
My biggest PR to date, about 0.3 Lines have been changed!
Closes https://github.com/rust-lang/rust-clippy/issues/8062
The suggestion seems to work well, as we've received no error reports since the implementation in December. This PR therefore promotes the suggestion to `MachineApplicable`. The tests already include `.fixed` files :)
changelog: [`search_is_some`]: Make more suggestions `MachineApplicable`
xFrednet [Mon, 14 Mar 2022 21:39:36 +0000 (22:39 +0100)]
Allow `single_component_path_imports` for all macros
xFrednet [Mon, 14 Mar 2022 21:02:10 +0000 (22:02 +0100)]
Make `search_is_some`s suggestion `MachineApplicable`
flip1995 [Mon, 14 Mar 2022 11:02:53 +0000 (12:02 +0100)]
bors [Mon, 14 Mar 2022 10:34:17 +0000 (10:34 +0000)]
Auto merge of #8534 - flip1995:rustup, r=flip1995
Rustup
r? `@ghost`
changelog: none
flip1995 [Mon, 14 Mar 2022 10:29:39 +0000 (11:29 +0100)]
Bump nightly version -> 2022-03-14
flip1995 [Mon, 14 Mar 2022 10:29:18 +0000 (11:29 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup
bors [Sun, 13 Mar 2022 16:11:25 +0000 (16:11 +0000)]
Auto merge of #8422 - buttercrab:only_used_in_recursion, r=llogiq
new lint: `only_used_in_recursion`
changed:
- added `only_used_in_recursion`.
- fixed code that variables are only used in recursion.
- this would not lint when `unused_variable`
This fixes: #8390
-----
changelog: add lint [`only_used_in_recursion`]
Jaeyong Sung [Sun, 13 Mar 2022 15:13:57 +0000 (00:13 +0900)]
add clearing return vars
bors [Sun, 13 Mar 2022 14:49:56 +0000 (14:49 +0000)]
Auto merge of #8471 - J-ZhengLi:master-issue7040, r=llogiq
new lint that detects useless match expression
fixes #7040
changelog: Add new lint [`needless_match`] under complexity lint group
Tianyi Song [Fri, 11 Mar 2022 03:31:17 +0000 (11:31 +0800)]
Check if lhs < rhs in modulos and emit
Nicholas Nethercote [Fri, 4 Mar 2022 20:28:41 +0000 (07:28 +1100)]
Improve `AdtDef` interning.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
Eric Holk [Fri, 11 Mar 2022 01:24:08 +0000 (17:24 -0800)]
Remove is_autoref parameter
Jaeyong Sung [Thu, 10 Mar 2022 07:06:35 +0000 (16:06 +0900)]
remove parameters that are only used in recursion