Commit graph

10875 commits

Author SHA1 Message Date
Cameron Steffen
ada8c72f3f Add version = "Two" to rustfmt.toml
Ignore UI tests since this change makes rustfmt less friendly with UI
test comments.
2021-03-01 16:17:33 -06:00
bors
5ae1e17e81 Auto merge of #6813 - matthiaskrgr:lintcheck_refactor, r=flip1995
lintcheck, do some refactoring and add more sources

refactor: add a Config object
don't run in parallel mode by default (it didn't make sense because cargo would lock the shared target dir anyway)
show full paths (from repo root) to the source files in clippy warnings so we can just copy the path from the logfile
fix more bugs
add more crates by dtolnay and embark to the sources toml

changelog: lintcheck: refactor some code and add more sources
2021-03-01 11:37:08 +00:00
Matthias Krüger
25f909863b update lintcheck_crates logs and fix typos 2021-02-28 23:07:12 +01:00
Matthias Krüger
45d6a77ce8 lintcheck: add more embark crate sources to the sources toml 2021-02-28 23:07:11 +01:00
Matthias Krüger
1ebaae8a15 lintcheck: make download path and source path consts, move source directory from traget/lintcheck/crates to target/lintcheck/sources
also update logfile with the dtolnay crates
2021-02-28 23:07:09 +01:00
Matthias Krüger
70d952e751 lintcheck: more fixes
fix a couple of issues when checking if lintcheck needed rerun after clippy binary changed.
I was apparently still comparing the times wrongly, but it should be fixed™ now...
I actually looked at the date of the sources.toml and not at the date of the log file!

Also fix progress report counter not advancing in squential mode
2021-02-28 22:59:46 +01:00
Matthias Krüger
b9a7a2a275 lintcheck: add a couple of dtolnays crates to the source list 2021-02-28 22:59:46 +01:00
Matthias Krüger
1b1ed9359e lintcheck: put the full paths (target/lintcheck/sources/<crate>...) to the source files of a warning into the lintcheck log
This is more convenient when reviewing new lint warnings that popped up in the logs
2021-02-28 22:59:45 +01:00
Matthias Krüger
e3386041a2 lintcheck: uses consts for clippy driver and cargo clippy paths 2021-02-28 22:53:52 +01:00
Matthias Krüger
2d9932d720 lintcheck: don't run clippy in parallel by default 2021-02-28 22:53:52 +01:00
Matthias Krüger
d931d1b5e6 lintcheck: refactor: introduce a basic LintcheckConfig struct which holds the job limit and paths to the sources and log files 2021-02-28 22:53:52 +01:00
bors
ac2f041b47 Auto merge of #6787 - matthiaskrgr:lint_msgs, r=llogiq
tests: add test that roughly ensures that our lint messages conform with the diagnostics convention of the rustc dev guide

lint message should not start with uppercase letters
lint messages should not have punctuation at the end of the last line

https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure

The test reads through all the .stderr files in the testsuit and checks lint messages that start with "help: ", "error: " etc.
There is also an exception list for special messages that are deemed acceptable.

changelog: make sure lint messages conform with the rustc dev guide and add test
2021-02-28 20:57:48 +00:00
Matthias Krüger
ebc5c8f271 use different example (C-like) for valid capitalized start of lint message 2021-02-28 14:01:45 +01:00
Matthias Krüger
24460f76cb lintcheck: update logs 2021-02-28 02:22:05 +01:00
Matthias Krüger
e00b1cc73a change some lint messages and remove old entries from the ignorelist 2021-02-28 02:22:05 +01:00
Matthias Krüger
e107b65b5a disable lint_message_convention test inside the rustc test suite 2021-02-28 02:22:05 +01:00
Matthias Krüger
8eb2bd13d0 update the lint messages and tests 2021-02-28 02:22:05 +01:00
Matthias Krüger
5370576882 fix clippy lint warnings 2021-02-28 02:22:05 +01:00
Matthias Krüger
b119b65859 tests: add test that roughly ensures that our lint messages conform with the diagnostics convention of the rustc dev guide
lint message should not start with uppercase letters
lint messages should not have punctuation at the end of the last line

https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure

The test reads through all the .stderr files in the testsuit and checks lint messages that start with "help: ", "error: " etc.
There is also an exception list for special messages that are deemed acceptable.

changelog: make sure lint messages conform with the rustc dev guide and add test
2021-02-28 02:22:05 +01:00
bors
abd2c7ebfb Auto merge of #6802 - camsteffen:dogfood-fix, r=llogiq
Remove workspace and fix dogfood (again)

changelog: none

In response to https://github.com/rust-lang/rust-clippy/pull/6733#issuecomment-785792060
2021-02-28 00:49:02 +00:00
bors
6971b0d199 Auto merge of #6812 - Y-Nak:fix-6792, r=matthiaskrgr
Fix ICEs 6792 and 6793

fixes #6792, fixes #6793.
r? `@matthiaskrgr`

Fixes the ICEs by replacing `TyCtxt::type_of` with `TypeckResults::expr_ty`.

changelog: none
2021-02-27 14:44:02 +00:00
Yoshitomo Nakanishi
e51bb0ee26 Add test for ICE 6793 2021-02-27 22:57:30 +09:00
Yoshitomo Nakanishi
bdeec5dbd6 Use TypeckResults::expr_ty instead of TyCtxt::type_of to fix "Not a type" ICE 2021-02-27 22:57:29 +09:00
bors
7154b23601 Auto merge of #6730 - anall:feature/owned_to_owned_methods, r=camsteffen
added new lint `owned_to_owned`

Adding new lint `owned_to_owned`

Creating draft PR to have this looked over.
I think this takes all advice I received into account.

I did have to update the `redundant_clone` test to ignore this lint -- I felt that was the safest action.

closes: #6715
changelog: added new lint `implicit_clone`
2021-02-27 01:40:05 +00:00
Andrea Nall
3d3cfd3754 added new lint implicit_clone 2021-02-26 19:13:47 -06:00
bors
6343446b89 Auto merge of #6800 - matthiaskrgr:lintcheck_stats, r=llogiq
lintcheck: print stats how lint counts change

The stats look like this:
````
Stats:
clippy::manual_map 0 => 10
clippy::missing_panics_doc 54 => 56
clippy::upper_case_acronyms 18 => 4
````

changelog: lintcheck: print stats about changing lint counts in the log
2021-02-26 19:30:57 +00:00
Cameron Steffen
d71ed26fd2 Revert "Fix versioncheck test"
This reverts commit 1e7b1ccb2a.
2021-02-26 12:30:43 -06:00
Cameron Steffen
aef6dc23ee Add package arguments to dogfood test
This is necessary after migrating to RUSTC_WORKSPACE_WRAPPER.
2021-02-26 12:12:33 -06:00
Cameron Steffen
fb905dffb4 Revert "Add workspace to manifest"
This reverts commit 9bcb257985.
2021-02-26 12:11:47 -06:00
Cameron Steffen
814b006d03 Revert "Fix lintcheck by excluding checked crates from workspace"
This reverts commit aea55d2c62.
2021-02-26 12:11:35 -06:00
Cameron Steffen
1368cb34d1 Revert "Test workspace at once"
This reverts commit e355652fec.
2021-02-26 12:10:24 -06:00
bors
186bf1ccb4 Auto merge of #6796 - dtolnay-contrib:manualmap, r=flip1995
Downgrade manual_map to nursery

I believe #6795 should be considered a blocker for this lint to be considered for enabling by default.

---

changelog: remove manual_map from default list of enabled lints
2021-02-26 15:28:10 +00:00
Matthias Krüger
90cf27e9f6 lintcheck: update logs and do minor fixes 2021-02-26 11:18:59 +01:00
Matthias Krüger
3e1eea6c97 lintcheck: print stats how lint counts have changed between runs 2021-02-26 11:08:42 +01:00
Matthias Krüger
12dc03033f lintcheck: fix bug when getting the config toml path.
In order to check if we need to recheck crates, I was getting the path from clap only
which is None if we don't pass it via cmdline args.

Use the dedicated lintcheck_config_toml() fnuction instead!
2021-02-26 10:59:40 +01:00
David Tolnay
8f47a4214e
Downgrade manual_map to nursery 2021-02-25 20:31:24 -08:00
bors
d5223be2e3 Auto merge of #6601 - mdm:fix-unit-args-false-positive, r=camsteffen
Fix false positive for unit_arg lint

Fixes #6447

To avoid false positives don't complain about unit args when they come from a path expression, e.g. a local variable.

**Note:** This is my first contribution to Clippy, so I might have messed up somewhere. Any feedback is welcome and I'm happy to work out any kinks.

---

changelog: Do not lint unit arguments when they come from a path expression.
2021-02-25 21:16:02 +00:00
Marc Dominik Migge
cbe6eec3e6 Add original test case from issue 2021-02-25 22:03:11 +01:00
bors
5c6cd87b94 Auto merge of #6790 - mgacek8:issue_6748, r=Manishearth
or_fun_call: fix suggestion for `or_insert(vec![])`

fixes #6748
changelog: or_fun_call: fix suggestion for `or_insert(vec![])` on `std::collections::hash_map::Entry` or `std::collections::btree_map::Entry`
2021-02-25 15:05:06 +00:00
Mateusz Gacek
2f0e9f7d3a or_fun_call: fix suggestion for or_insert(vec![])
Applies for `std::collections::hash_map::Entry` and `std::collections::btree_map::Entry`

Example:
Previously, for the following code:
`let _ = hash_map.entry("test".to_owned()).or_insert(vec![]);`
clippy would suggest to use:
`or_insert_with(vec![])`, which causes a compiler error (E0277).

Now clippy suggests:
`or_insert_with(Vec::new)`
2021-02-25 14:23:38 +01:00
bors
928e72dd10 Auto merge of #6789 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: None
2021-02-25 09:49:12 +00:00
flip1995
8f8c7c293c
Bump nightly version -> 2021-02-25 2021-02-25 10:40:24 +01:00
flip1995
c6408a47bd
Merge remote-tracking branch 'upstream/master' into rustup 2021-02-25 10:40:00 +01:00
bors
ef41f2baf7 Auto merge of #6788 - matthiaskrgr:upper_case_acronyms, r=flip1995
move upper_case_acronyms back to style, but make the default behaviour less aggressive by default (can be unleashed via config option)

Previous discussion in the bi-weekly clippy meeting for reference: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202021-02-23/near/227458019

Move the `upper_case_acronyms` lint back to the style group.
Only warn on fully-capitalized names by default.
Add add a clippy-config option `upper-case-acronyms-aggressive: true/false` to enabled more aggressive linting on
all substrings that could be capitalized acronyms.

---
changelog: reenable upper_case_acronyms by default but make the more aggressive linting opt-in via config option
2021-02-25 09:01:41 +00:00
Matthias Krüger
2a6b06108d run cargo dev update_lints
fix sentence / address review comments
2021-02-25 09:59:39 +01:00
bors
76a689d8c2 Auto merge of #6783 - avitex:add-opendns-ident, r=giraffate
Add OpenDNS to `doc-valid-idents`

changelog: This commit adds `"OpenDNS"` to doc-valid-idents to avoid `doc_markdown` false positives.
2021-02-25 00:22:39 +00:00
Matthias Krüger
913c71018c upper_case_acronyms: add io-toml tests and bless previous tests 2021-02-24 23:50:55 +01:00
Matthias Krüger
59750dceb8 upper_case_acronyms: add optional aggressive mode and relax default
Moves the lint back from pedantic to style group.
The lint default now only warns on names that are completely capitalized, like "WORD"
and only if the name is longer than 2 chars (so that names where each of the letter represents a word are still distinguishable).
For example: FP (false positive) would still be "valid" and not warned about (but EOF would warn).

A "upper_case_acronyms_aggressive: true/false" config option was added that restores the original lint behaviour to warn
on any kind of camel case name that had more than one capital letter following another capital letter.
2021-02-24 23:50:53 +01:00
avitex
b0d18e93d6
add test coverage for all doc-valid-idents 2021-02-25 09:30:33 +11:00
avitex
72e3335684
Add OpenDNS to doc-valid-idents 2021-02-25 09:30:33 +11:00