]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd some restrictions to default_numeric_fallback to avoid FNs
Yoshitomo Nakanishi [Mon, 15 Feb 2021 05:22:31 +0000 (14:22 +0900)]
Add some restrictions to default_numeric_fallback to avoid FNs

3 years agoSimplify DefaultNumericFallback
Yoshitomo Nakanishi [Sun, 7 Feb 2021 09:00:08 +0000 (18:00 +0900)]
Simplify DefaultNumericFallback

3 years agoFix enclosing_body_owner_opt and rename it to enclosing_body_opt
Yoshitomo Nakanishi [Thu, 4 Feb 2021 13:57:03 +0000 (22:57 +0900)]
Fix enclosing_body_owner_opt and rename it to enclosing_body_opt

3 years agoNew lint: default_numeric_fallback
Yoshitomo Nakanishi [Tue, 2 Feb 2021 03:26:20 +0000 (12:26 +0900)]
New lint: default_numeric_fallback

3 years agoAuto merge of #6669 - magurotuna:fix-test-name, r=flip1995
bors [Wed, 3 Feb 2021 15:39:37 +0000 (15:39 +0000)]
Auto merge of #6669 - magurotuna:fix-test-name, r=flip1995

Fix file names of flat_map_identity test

This patch fixes the file names of the `flat_map_identity` test.
Previously, their names were started with `unnecessary_flat_map` even though the lint rule name is `flat_map_identity`. This inconsistency happened probably because the rule name was changed during the discussion in the PR where this rule was introduced.

ref: https://github.com/rust-lang/rust-clippy/pull/4231

changelog: none

3 years agoFix file names of flat_map_identity test
Yusuke Tanaka [Wed, 3 Feb 2021 15:06:26 +0000 (00:06 +0900)]
Fix file names of flat_map_identity test

This commit fixes the file names of the `flat_map_identity` test.
Previously, their names were started with `unnecessary_flat_map` even
though the lint rule name is `flat_map_identity`. This inconsistency
happened probably because the rule name was changed during the
discussion in the PR where this rule was introduced.

ref: https://github.com/rust-lang/rust-clippy/pull/4231

3 years agoAuto merge of #6667 - Manishearth:rustup, r=Manishearth
bors [Wed, 3 Feb 2021 04:09:03 +0000 (04:09 +0000)]
Auto merge of #6667 - Manishearth:rustup, r=Manishearth

Rustup

Pulling in AST changes

changelog: none

3 years agoMerge branch 'sync-from-rust3' into rustup
Manish Goregaokar [Wed, 3 Feb 2021 03:57:31 +0000 (19:57 -0800)]
Merge branch 'sync-from-rust3' into rustup

3 years agoRun rustfmt
Manish Goregaokar [Wed, 3 Feb 2021 03:57:08 +0000 (19:57 -0800)]
Run rustfmt

3 years agoRustup
Manish Goregaokar [Wed, 3 Feb 2021 01:35:39 +0000 (17:35 -0800)]
Rustup

3 years agoMerge remote-tracking branch 'origin/master' into rustup
Manish Goregaokar [Wed, 3 Feb 2021 00:46:12 +0000 (16:46 -0800)]
Merge remote-tracking branch 'origin/master' into rustup

3 years agoRollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:33 +0000 (16:01 -0500)]
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum

Add .editorconfig

This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.

3 years agoAuto merge of #6639 - xFrednet:0000-configuration-documentation-some-nits, r=flip1995
bors [Tue, 2 Feb 2021 18:05:35 +0000 (18:05 +0000)]
Auto merge of #6639 - xFrednet:0000-configuration-documentation-some-nits, r=flip1995

Updated some NITs in the documentation from #6630

I've implemented the two suggestions from #6630 that were added after the merge. This PR also changes the example code to use `register_*_pass` instead of `register_late_pass`. I'm not sure if this is better or worse, but it makes it clearer in my opinion. Let me know if I should change it back.

---

changelog: none

r? `@flip1995`

3 years agoUpdated the list of active mentors
xFrednet [Tue, 2 Feb 2021 17:53:15 +0000 (18:53 +0100)]
Updated the list of active mentors

3 years agoAuto merge of #81405 - bugadani:ast, r=cjgillot
bors [Tue, 2 Feb 2021 17:34:08 +0000 (17:34 +0000)]
Auto merge of #81405 - bugadani:ast, r=cjgillot

Box the biggest ast::ItemKind variants

This PR is a different approach on https://github.com/rust-lang/rust/pull/81400, aiming to save memory in humongous ASTs.

The three affected item kind enums are:
 - `ast::ItemKind` (208 -> 112 bytes)
 - `ast::AssocItemKind` (176 -> 72 bytes)
 - `ast::ForeignItemKind` (176 -> 72 bytes)

3 years agoAdd .editorconfig
Vasili Novikov [Fri, 22 Jan 2021 08:51:23 +0000 (09:51 +0100)]
Add .editorconfig

Editorconfig is a lightweight specification that
helps maintaining consistent coding/formatting style
accross editors, especially those editors
that are not explicitly aware of Rust and rustfmt.

https://editorconfig.org/

3 years agoAuto merge of #6664 - camsteffen:path-to-res, r=Manishearth
bors [Tue, 2 Feb 2021 16:56:39 +0000 (16:56 +0000)]
Auto merge of #6664 - camsteffen:path-to-res, r=Manishearth

Remove Option from `path_to_res` return type

changelog: none

Tiny cleanup for `path_to_res` to return `Res` instead of `Option<Res>`.

3 years agoAuto merge of #6523 - brightly-salty:missing-panic-doc, r=flip1995
bors [Tue, 2 Feb 2021 15:37:24 +0000 (15:37 +0000)]
Auto merge of #6523 - brightly-salty:missing-panic-doc, r=flip1995

Add new lint "missing_panics_doc"

fixes #1974
changelog: Added the "missing_panics_doc" lint which lints when public functions that may panic are missing "# Panics" in their doc comment

3 years agoAdd missing_panics_doc lint
Caden Haustein [Wed, 30 Dec 2020 22:37:59 +0000 (16:37 -0600)]
Add missing_panics_doc lint

3 years agoAuto merge of #6659 - phlip9:let_and_return_fix, r=phansch
bors [Tue, 2 Feb 2021 15:04:35 +0000 (15:04 +0000)]
Auto merge of #6659 - phlip9:let_and_return_fix, r=phansch

Fix let_and_return false positive

The issue:

link: https://play.rust-lang.org/?edition=2018&gist=12cb5d1e7527f8c37743b87fc4a53748
Run the above with clippy to see the following warning:

```
warning: returning the result of a `let` binding from a block
  --> src/main.rs:24:5
   |
23 |     let value = Foo::new(&x).value();
   |     --------------------------------- unnecessary `let` binding
24 |     value
   |     ^^^^^
   |
   = note: `#[warn(clippy::let_and_return)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
23 |
24 |     Foo::new(&x).value()
   |
```

Implementing the suggested fix, removing the temporary let binding,
yields a compiler error:

```
error[E0597]: `x` does not live long enough
  --> src/main.rs:23:14
   |
23 |     Foo::new(&x).value()
   |     ---------^^-
   |     |        |
   |     |        borrowed value does not live long enough
   |     a temporary with access to the borrow is created here ...
24 | }
   | -
   | |
   | `x` dropped here while still borrowed
   | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `Foo`
   |
   = note: the temporary is part of an expression at the end of a block;
           consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
   |
23 |     let x = Foo::new(&x).value(); x
   |     ^^^^^^^                     ^^^
```

The fix:

Of course, clippy looks like it should already handle this edge case;
however, it appears `utils::fn_def_id` is not returning a `DefId` for
`Foo::new`. Changing the `qpath_res` lookup to use the child Path
`hir_id` instead of the parent Call `hir_id` fixes the issue.

changelog: none

3 years agoAuto merge of #6661 - Manishearth:exhaustive-fix, r=flip1995
bors [Tue, 2 Feb 2021 07:59:39 +0000 (07:59 +0000)]
Auto merge of #6661 - Manishearth:exhaustive-fix, r=flip1995

exhaustive_structs: don't trigger for structs with private fields

changelog: Restrict `exhaustive_structs` to structs with all-public
fields

3 years agoFix test formatting
Philipp Krones [Tue, 2 Feb 2021 07:59:23 +0000 (08:59 +0100)]
Fix test formatting

3 years agoexhaustive_structs: don't trigger for structs with private fields
Manish Goregaokar [Tue, 2 Feb 2021 02:38:43 +0000 (18:38 -0800)]
exhaustive_structs: don't trigger for structs with private fields

3 years agoAuto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
bors [Mon, 1 Feb 2021 10:25:31 +0000 (10:25 +0000)]
Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov

Implement Rust 2021 panic

This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007.

It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller.

This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.

3 years agoBox the biggest ast::ItemKind variants
Dániel Buga [Fri, 29 Jan 2021 07:31:08 +0000 (08:31 +0100)]
Box the biggest ast::ItemKind variants

3 years agoRemove Option from path_to_res return type
Cameron Steffen [Mon, 25 Jan 2021 19:39:35 +0000 (13:39 -0600)]
Remove Option from path_to_res return type

3 years agoAuto merge of #6603 - ThibsG:MatchOverlappingArm5986, r=flip1995
bors [Sun, 31 Jan 2021 15:09:55 +0000 (15:09 +0000)]
Auto merge of #6603 - ThibsG:MatchOverlappingArm5986, r=flip1995

Do not lint when range is completely included into another one

This fix has been developed following this [comment](https://github.com/rust-lang/rust-clippy/issues/5986#issuecomment-703313548).
So this will be linted:
```
|----------|
        |-----------|
```
Now this won't be linted:
```
              |---|
|--------------------|
```
and this will still lint:
```
|--------|
|--------------|
```

Fixes: #5986
changelog: Fix FPs in match_overlapping_arm, when first arm is completely included in second arm

3 years agoAuto merge of #6656 - phansch:command-failed-print-stderr, r=flip1995
bors [Sun, 31 Jan 2021 14:56:53 +0000 (14:56 +0000)]
Auto merge of #6656 - phansch:command-failed-print-stderr, r=flip1995

clippy_dev: Pass stderr to CommandFailed

This improves error reporting when running `rustfmt` fails for some reason, as seen [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20with.20rustfmt). It will now include the stderr output in the `CliError::CommandFailed` error.

changelog: none

3 years agoclippy_dev: Pass stderr to CommandFailed
Philipp Hansch [Sun, 31 Jan 2021 10:17:37 +0000 (11:17 +0100)]
clippy_dev: Pass stderr to CommandFailed

3 years agoUpdate clippy test output for panic macros.
Mara Bos [Sat, 30 Jan 2021 18:33:21 +0000 (19:33 +0100)]
Update clippy test output for panic macros.

3 years agoMerge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup
flip1995 [Sat, 30 Jan 2021 17:06:34 +0000 (18:06 +0100)]
Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup

3 years agoAuto merge of #6654 - flip1995:no_lazy_static_regex, r=flip1995
bors [Sat, 30 Jan 2021 16:49:45 +0000 (16:49 +0000)]
Auto merge of #6654 - flip1995:no_lazy_static_regex, r=flip1995

No lazy static regex

r? `@llogiq`

#6500

regex is unnecessary for this lint (https://github.com/rust-lang/rust-clippy/pull/6500#discussion_r558555071)
lazy_static is unnecessary. The std lazy feature should be  used instead.

changelog: none

3 years agoRemove unknown_clippy_lints allow attribute
flip1995 [Sat, 30 Jan 2021 16:43:20 +0000 (17:43 +0100)]
Remove unknown_clippy_lints allow attribute

3 years agoGet rid of regex and lazy_static dependencies
flip1995 [Sat, 30 Jan 2021 16:43:00 +0000 (17:43 +0100)]
Get rid of regex and lazy_static dependencies

3 years agoAuto merge of #6653 - flip1995:rustup, r=flip1995
bors [Sat, 30 Jan 2021 14:53:30 +0000 (14:53 +0000)]
Auto merge of #6653 - flip1995:rustup, r=flip1995

Rustup

changelog: Deprecate `unknown_clippy_lints` (integrated in `unknown_lints`)

r? `@ghost`

3 years agoBump nightly version -> 2021-01-30
flip1995 [Sat, 30 Jan 2021 14:52:02 +0000 (15:52 +0100)]
Bump nightly version -> 2021-01-30

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sat, 30 Jan 2021 14:51:16 +0000 (15:51 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoFix let_and_return false positive
Philip Hayes [Sat, 30 Jan 2021 06:17:18 +0000 (22:17 -0800)]
Fix let_and_return false positive

The issue:

link: https://play.rust-lang.org/?edition=2018&gist=12cb5d1e7527f8c37743b87fc4a53748
Run the above with clippy to see the following warning:

```
warning: returning the result of a `let` binding from a block
  --> src/main.rs:24:5
   |
23 |     let value = Foo::new(&x).value();
   |     --------------------------------- unnecessary `let` binding
24 |     value
   |     ^^^^^
   |
   = note: `#[warn(clippy::let_and_return)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
23 |
24 |     Foo::new(&x).value()
   |
```

Implementing the suggested fix, removing the temporary let binding,
yields a compiler error:

```
error[E0597]: `x` does not live long enough
  --> src/main.rs:23:14
   |
23 |     Foo::new(&x).value()
   |     ---------^^-
   |     |        |
   |     |        borrowed value does not live long enough
   |     a temporary with access to the borrow is created here ...
24 | }
   | -
   | |
   | `x` dropped here while still borrowed
   | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `Foo`
   |
   = note: the temporary is part of an expression at the end of a block;
           consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
   |
23 |     let x = Foo::new(&x).value(); x
   |     ^^^^^^^                     ^^^
```

The fix:

Of course, clippy looks like it should already handle this edge case;
however, it appears `utils::fn_def_id` is not returning a `DefId` for
`Foo::new`. Changing the `qpath_res` lookup to use the child Path
`hir_id` instead of the parent Call `hir_id` fixes the issue.

3 years agoRollup merge of #81176 - camsteffen:qpath-res, r=oli-obk
Yuki Okushi [Fri, 29 Jan 2021 00:17:32 +0000 (09:17 +0900)]
Rollup merge of #81176 - camsteffen:qpath-res, r=oli-obk

Improve safety of `LateContext::qpath_res`

This is my first rustc code change, inspired by hacking on clippy!

The first change is to clear cached `TypeckResults` from `LateContext` when visiting a nested item. I took a hint from [here](https://github.com/rust-lang/rust/blob/5e91c4ecc09312d8b63d250a432b0f3ef83f1df7/compiler/rustc_privacy/src/lib.rs#L1300).

Clippy has a `qpath_res` util function to avoid a possible ICE in `LateContext::qpath_res`. But the docs of `LateContext::qpath_res` promise no ICE. So this updates the `LateContext` method to keep its promises, and removes the util function.

Related: rust-lang/rust-clippy#4545

CC ````````````@eddyb```````````` since you've done related work
CC ````````````@flip1995```````````` FYI

3 years agoRollup merge of #81277 - flip1995:from_diag_items, r=matthewjasper
Yuki Okushi [Thu, 28 Jan 2021 06:09:08 +0000 (15:09 +0900)]
Rollup merge of #81277 - flip1995:from_diag_items, r=matthewjasper

Make more traits of the From/Into family diagnostic items

Following traits are now diagnostic items:
- `From` (unchanged)
- `Into`
- `TryFrom`
- `TryInto`

This also adds symbols for those items:
- `into_trait`
- `try_from_trait`
- `try_into_trait`

Related: https://github.com/rust-lang/rust-clippy/pull/6620#discussion_r562482587

3 years agoRollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis
Yuki Okushi [Thu, 28 Jan 2021 06:09:02 +0000 (15:09 +0900)]
Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis

Refractor a few more types to `rustc_type_ir`

In the continuation of #79169, ~~blocked on that PR~~.

This PR:
 - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance`
 - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler.

~~I will split up that commit to make this easier to review and to have a better commit history.~~
EDIT: done, I split the PR in commits of 200-ish lines each

r? `````@nikomatsakis````` cc `````@jackh726`````

3 years agoAuto merge of #6645 - camsteffen:syntax-highlighting, r=phansch
bors [Wed, 27 Jan 2021 06:47:07 +0000 (06:47 +0000)]
Auto merge of #6645 - camsteffen:syntax-highlighting, r=phansch

Fix website syntax highlighting

changelog: none

Fix syntax highlighting on website when the docs contain ` ```rust,ignore`

3 years agoFix some website syntax highlighting
Cameron Steffen [Tue, 26 Jan 2021 23:38:37 +0000 (17:38 -0600)]
Fix some website syntax highlighting

3 years agoAdded the rustbot claim command to the contribution guide.
xFrednet [Tue, 26 Jan 2021 17:36:43 +0000 (18:36 +0100)]
Added the rustbot claim command to the contribution guide.

3 years agoAuto merge of #6469 - matthiaskrgr:clippy_dev_crater, r=flip1995
bors [Tue, 26 Jan 2021 06:58:04 +0000 (06:58 +0000)]
Auto merge of #6469 - matthiaskrgr:clippy_dev_crater, r=flip1995

add "cargo dev crater" to run clippy on a fixed set of crates and diff the lint warnings

`cargo dev crater` now does the following:
build clippy in debug mode
for a fixed set of crates:
 download and extract the crate
 run compiled clippy on the crate
 dump the warnings into a file that is inside the repo

We can then do a "git diff" and see what effects our clippy changes had on a tiny fraction of the rust ecosystem and can see when an change unexpectedly added or silenced a lot of warnings.

Checking all the crates took less than 5 minutes on my system.

Should help with https://github.com/rust-lang/rust-clippy/issues/6429

---

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: extend cargo dev to run clippy against a fixed set of crates and compare warnings

3 years agoAuto merge of #6617 - Manishearth:exhaustive_enums, r=camsteffen
bors [Mon, 25 Jan 2021 23:06:39 +0000 (23:06 +0000)]
Auto merge of #6617 - Manishearth:exhaustive_enums, r=camsteffen

New lint: exhaustive_enums, exhaustive_structs

Fixes #6616

changelog: Added restriction lint: `exhaustive_enums`, `exhaustive_structs`

3 years agoAdd test with attrs
Manish Goregaokar [Mon, 25 Jan 2021 22:39:03 +0000 (14:39 -0800)]
Add test with attrs

3 years agoBetter suggestion span
Manish Goregaokar [Mon, 25 Jan 2021 22:35:57 +0000 (14:35 -0800)]
Better suggestion span

3 years agoUpdated some NITs in the documentation from #6630
xFrednet [Mon, 25 Jan 2021 18:46:19 +0000 (19:46 +0100)]
Updated some NITs in the documentation from #6630

3 years agoAuto merge of #6630 - xFrednet:0000-configuration-documentation, r=llogiq
bors [Mon, 25 Jan 2021 00:25:31 +0000 (00:25 +0000)]
Auto merge of #6630 - xFrednet:0000-configuration-documentation, r=llogiq

Documentation for adding configuration to a lint and common abbreviations

This PR adds some commonly used abbreviations to the `basis.md` file and a guide on how to implement a configuration value for a lint.

* [Rendered `/doc/basics.md` (Abbreviation list)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/basics.md#common-abbreviations)
* [Rendered `/doc/adding_lints.md` (Configuration value guide)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/adding_lints.md#adding-configuration-to-a-lint)

I'm not sure if the guide is written in the best way. Style suggestions are appreciated. :upside_down_face:

 ---

Again a big **thank you** for everyone who helped to collect the abbreviation list over on [zulip]. I had a lot of fun, and it was also very informative. Keep up the good work :upside_down_face:

[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Common.20abbreviations.20in.20basics.2Emd/near/223548065
---

changelog: none

3 years agoAdded documentation for adding a configuration to lints
xFrednet [Fri, 22 Jan 2021 18:04:28 +0000 (19:04 +0100)]
Added documentation for adding a configuration to lints

* Fixed some spelling

3 years agoAdd more tests for `match_overlapping_arm` lint
ThibsG [Sun, 24 Jan 2021 11:28:59 +0000 (12:28 +0100)]
Add more tests for `match_overlapping_arm` lint

3 years agolintcheck: fix paths in the logs
Matthias Krüger [Sat, 23 Jan 2021 00:09:51 +0000 (01:09 +0100)]
lintcheck: fix paths in the logs

3 years agoupdate lintcheck-logs
Matthias Krüger [Sat, 23 Jan 2021 00:08:48 +0000 (01:08 +0100)]
update lintcheck-logs

3 years agorename cargo dev crater to cargo dev lintcheck
Matthias Krüger [Fri, 22 Jan 2021 23:25:29 +0000 (00:25 +0100)]
rename cargo dev crater to cargo dev lintcheck

3 years agoclippy dev crater: address more review commetns
Matthias Krüger [Tue, 29 Dec 2020 15:18:31 +0000 (16:18 +0100)]
clippy dev crater: address more review commetns

make serde a feature-dep
save clippy version in the crater log

3 years agoadd shortcut "dev-crater" command to build and run "cargo dev crater"
Matthias Krüger [Sun, 27 Dec 2020 15:56:05 +0000 (16:56 +0100)]
add shortcut "dev-crater" command to build and run "cargo dev crater"

3 years agocargo dev crater: throw an error if we can't find our specified crate in the .toml...
Matthias Krüger [Sun, 27 Dec 2020 15:20:32 +0000 (16:20 +0100)]
cargo dev crater: throw an error if we can't find our specified crate in the .toml list

3 years agoclippy dev crater: add option to only check a single one of the listed crates with...
Matthias Krüger [Sun, 27 Dec 2020 15:13:42 +0000 (16:13 +0100)]
clippy dev crater: add option to only check a single one of the listed crates with  --only crate

3 years agomake stats stable
Matthias Krüger [Sun, 27 Dec 2020 14:44:45 +0000 (15:44 +0100)]
make stats stable

3 years agocargo dev crater: gather and save lint statistics (how often a lint triggered)
Matthias Krüger [Wed, 23 Dec 2020 14:59:16 +0000 (15:59 +0100)]
cargo dev crater: gather and save lint statistics (how often a lint triggered)

3 years agocargo dev crater: refactor to get a list of all ClippyWarnings
Matthias Krüger [Wed, 23 Dec 2020 14:31:18 +0000 (15:31 +0100)]
cargo dev crater: refactor to get a list of all ClippyWarnings

3 years agoclippy dev crater: use and parse clippy messages as json message, to get the lint...
Matthias Krüger [Wed, 23 Dec 2020 14:00:51 +0000 (15:00 +0100)]
clippy dev crater: use and parse clippy messages as json message, to get the lint name of a warning

3 years agoremove duplicate code and other cleanup
Matthias Krüger [Wed, 23 Dec 2020 12:03:19 +0000 (13:03 +0100)]
remove duplicate code and other cleanup

3 years agorename symbols: krate -> crate
Matthias Krüger [Wed, 23 Dec 2020 12:02:02 +0000 (13:02 +0100)]
rename symbols: krate -> crate

3 years agocargo dev crater: support multiple versions per crate
Matthias Krüger [Wed, 23 Dec 2020 00:21:31 +0000 (01:21 +0100)]
cargo dev crater: support multiple versions per crate

3 years agouse a .toml file to list the crates we want to check
Matthias Krüger [Tue, 22 Dec 2020 12:07:55 +0000 (13:07 +0100)]
use a .toml file to list the crates we want to check

Also sort lint results alphabetically.

3 years agoallow clippy::filter_map
Matthias Krüger [Fri, 18 Dec 2020 21:53:45 +0000 (22:53 +0100)]
allow clippy::filter_map

3 years agocargo dev crater: share target dir between clippy runs, enable pedantic and cargo...
Matthias Krüger [Fri, 18 Dec 2020 21:08:18 +0000 (22:08 +0100)]
cargo dev crater:  share target dir between clippy runs, enable pedantic and cargo lints, ignore tokei for now.

3 years agocargo dev crater: add more crates to be checked
Matthias Krüger [Fri, 18 Dec 2020 20:50:06 +0000 (21:50 +0100)]
cargo dev crater: add more crates to be checked

3 years agoadd the log file
Matthias Krüger [Fri, 18 Dec 2020 20:27:17 +0000 (21:27 +0100)]
add the log file

3 years agocargo dev crater: save all warnings into a file
Matthias Krüger [Fri, 18 Dec 2020 20:26:41 +0000 (21:26 +0100)]
cargo dev crater: save all warnings into a file

3 years agocargo dev crater: cleanup, don't re-download and reextract crates on every run
Matthias Krüger [Fri, 18 Dec 2020 19:58:46 +0000 (20:58 +0100)]
cargo dev crater: cleanup, don't re-download and reextract crates on every run

3 years agoprint all clippy warnings in the end
Matthias Krüger [Fri, 18 Dec 2020 17:34:09 +0000 (18:34 +0100)]
print all clippy warnings in the end

3 years agocargo clippy dev: collecting one-line clippy warnings works now
Matthias Krüger [Fri, 18 Dec 2020 17:01:45 +0000 (18:01 +0100)]
cargo clippy dev: collecting one-line clippy warnings works now

3 years agoclippy cargo dev: fix checking of crates
Matthias Krüger [Fri, 18 Dec 2020 16:25:07 +0000 (17:25 +0100)]
clippy cargo dev: fix checking of crates

3 years agocargo clippy dev: fix extraction of downloaded crates
Matthias Krüger [Fri, 18 Dec 2020 15:53:18 +0000 (16:53 +0100)]
cargo clippy dev: fix extraction of downloaded crates

3 years agocargo dev crater: fixes and debug prints
Matthias Krüger [Fri, 18 Dec 2020 15:17:53 +0000 (16:17 +0100)]
cargo dev crater: fixes and debug prints

3 years agocrater: hook into main.rs
Matthias Krüger [Fri, 18 Dec 2020 13:28:59 +0000 (14:28 +0100)]
crater: hook into main.rs

3 years agocargo dev crater: work on downloading and extracting crate sources
Matthias Krüger [Fri, 18 Dec 2020 13:14:15 +0000 (14:14 +0100)]
cargo dev crater: work on downloading and extracting crate sources

3 years agocargo dev crater: lay out the base plan
Matthias Krüger [Fri, 18 Dec 2020 12:21:13 +0000 (13:21 +0100)]
cargo dev crater: lay out the base plan

3 years agoAuto merge of #6403 - camsteffen:similar-names-underscore, r=Manishearth
bors [Fri, 22 Jan 2021 23:44:12 +0000 (23:44 +0000)]
Auto merge of #6403 - camsteffen:similar-names-underscore, r=Manishearth

Similar names ignore underscore prefixed names

changelog: Ignore underscore-prefixed names for similar_names

IMO, this lint is not very helpful for underscore-prefixed variables. Usually they are unused or are just there to ignore part of a destructuring.

3 years agoAuto merge of #6619 - camsteffen:collapsible-match, r=camsteffen
bors [Fri, 22 Jan 2021 22:45:43 +0000 (22:45 +0000)]
Auto merge of #6619 - camsteffen:collapsible-match, r=camsteffen

Improve collapsible_match

changelog: Fix collapsible_match false negatives

Allow `&` and/or `*` on the binding and make sure the type still matches.

3 years agoFix dogfood
Cameron Steffen [Fri, 22 Jan 2021 01:25:22 +0000 (19:25 -0600)]
Fix dogfood

3 years agoEnhance collapsible_match for adjusted bindings
Cameron Steffen [Fri, 22 Jan 2021 01:21:12 +0000 (19:21 -0600)]
Enhance collapsible_match for adjusted bindings

3 years agoAuto merge of #6591 - camsteffen:manual-filter-map, r=llogiq
bors [Fri, 22 Jan 2021 22:28:41 +0000 (22:28 +0000)]
Auto merge of #6591 - camsteffen:manual-filter-map, r=llogiq

`manual_filter_map` and `manual_find_map`

changelog: Add `manual_filter_map` and replace `find_map` with `manual_find_map`

Replaces #6453

Fixes #3188
Fixes #4193

~Depends on #6567 (to fix an internal lint false positive)~

This replaces `filter_map` and `find_map` with `manual_filter_map` and `manual_find_map` respectively. However, `filter_map` is left in place since it is used for a variety of other cases. See discussion in #6453.

3 years agoClean up suggestion span; clarify help message
Manish Goregaokar [Fri, 22 Jan 2021 20:08:46 +0000 (12:08 -0800)]
Clean up suggestion span; clarify help message

3 years agoFix indentation of suggestion
Manish Goregaokar [Thu, 21 Jan 2021 22:00:25 +0000 (14:00 -0800)]
Fix indentation of suggestion

3 years agoAdd exhaustive_structs lint
Manish Goregaokar [Thu, 21 Jan 2021 21:41:57 +0000 (13:41 -0800)]
Add exhaustive_structs lint

3 years agoMake more traits of the From/Into family diagnostic items
flip1995 [Fri, 22 Jan 2021 17:07:00 +0000 (18:07 +0100)]
Make more traits of the From/Into family diagnostic items

Following traits are now diagnostic items:
- `From` (unchanged)
- `Into`
- `TryFrom`
- `TryInto`

This also adds symbols for those items:
- `into_trait`
- `try_from_trait`
- `try_into_trait`

3 years agoRollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk
Mara Bos [Fri, 22 Jan 2021 14:30:19 +0000 (14:30 +0000)]
Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk

Gracefully handle loop labels missing leading `'` in different positions

Fix #81192.

* Account for labels when suggesting `loop` instead of `while true`
* Suggest `'a` when given `a` only when appropriate
* Add loop head span to hir
* Tweak error for invalid `break expr`
* Add more misspelled label tests
* Avoid emitting redundant "unused label" lint
* Parse loop labels missing a leading `'`

Each commit can be reviewed in isolation.

3 years agoAuto merge of #6621 - giraffate:improve_the_example_in_ref_in_deref, r=flip1995
bors [Fri, 22 Jan 2021 14:04:31 +0000 (14:04 +0000)]
Auto merge of #6621 - giraffate:improve_the_example_in_ref_in_deref, r=flip1995

Improve the example in `ref_in_deref`

Add a suggested code to the example in doc

changelog: none

3 years agoImprove the example in `ref_in_deref`
Takayuki Nakata [Fri, 22 Jan 2021 13:51:06 +0000 (22:51 +0900)]
Improve the example in `ref_in_deref`

3 years agoAuto merge of #81135 - jyn514:no-backticks, r=flip1995
bors [Fri, 22 Jan 2021 06:13:19 +0000 (06:13 +0000)]
Auto merge of #81135 - jyn514:no-backticks, r=flip1995

Fix formatting for removed lints

- Don't add backticks for the reason a lint was removed. This is almost
never a code block, and when it is the backticks should be in the reason
itself.
- Don't assume clippy is the only tool that needs to be checked for
backwards compatibility

I split this out of https://github.com/rust-lang/rust/pull/80527/ because it kept causing tests to fail, and it's a good change to have anyway.

r? `@flip1995`

3 years agoFix clippy and comment
Esteban Küber [Fri, 22 Jan 2021 00:48:17 +0000 (16:48 -0800)]
Fix clippy and comment

3 years agoAdd loop head span to hir
Esteban Küber [Thu, 21 Jan 2021 01:15:08 +0000 (17:15 -0800)]
Add loop head span to hir

3 years agoDeprecate find_map lint
Cameron Steffen [Thu, 14 Jan 2021 22:47:22 +0000 (16:47 -0600)]
Deprecate find_map lint

3 years agoRemove unneeded allow's
Cameron Steffen [Mon, 14 Dec 2020 20:03:11 +0000 (14:03 -0600)]
Remove unneeded allow's

3 years agoReplace find_map with manual_find_map
Cameron Steffen [Thu, 14 Jan 2021 22:36:36 +0000 (16:36 -0600)]
Replace find_map with manual_find_map

3 years agoSplit filter_map into manual_filter_map
Cameron Steffen [Fri, 1 Jan 2021 19:00:09 +0000 (13:00 -0600)]
Split filter_map into manual_filter_map