Commit Graph

10314 Commits

Author SHA1 Message Date
Michael Wright
3af09b8cf1 New internal lint: interning_defined_symbol 2020-12-13 06:32:41 +02:00
bors
89c282fb63 Auto merge of #6318 - camsteffen:article-description, r=Manishearth
Use article_and_description for missing docs

Moves closer to the current rustc missing_doc lint

changelog: none
2020-12-12 21:20:40 +00:00
bors
3b89a672e2 Auto merge of #6382 - giraffate:fix_fp_in_manual_range_contains_when_const_fn, r=llogiq
Fix FP of `manual_range_contains` in `const fn`

Fix #6373.

changelog: Fix FP of `manual_range_contains` in `const fn`
2020-12-12 21:09:20 +00:00
bors
18c5ea4905 Auto merge of #6413 - phansch:bless, r=flip1995
Rewrite update-all-references bash scripts in Rust

This replaces the `update-all-references` scripts with a single

    cargo dev bless

command. It should behave mostly the same as the bash scripts. The major difference is, that it can be called from the project root and will always update the files in all of the test suites.

cc #5394

changelog: none
2020-12-12 14:42:28 +00:00
Philipp Hansch
b8501e1be1
Feed the dog 🐕 2020-12-12 15:14:54 +01:00
Philipp Hansch
41c562d4a5
Improve variable naming 2020-12-12 15:10:01 +01:00
Philipp Hansch
4bd9ed9b88
Rewrite update-all-references bash scripts in Rust
This replaces the `update-all-references` scripts with a single

    cargo dev bless

command.

cc #5394
2020-12-12 15:09:57 +01:00
Matthias Krüger
b2cb6ffbe3 clone_on_copy: show the type in the lint message
changelog: clone_on_copy: show the type in the lint message
2020-12-12 01:23:28 +01:00
Matthias Krüger
0b145d688b clone_double_ref: print reference type in lint message
changelog: clone_double_ref: print the type of the reference in lint message
2020-12-12 01:09:30 +01:00
Jack Huey
30ef1770d3 Move binder for dyn to each list item 2020-12-11 15:02:46 -05:00
bors
baf5f2da8b Auto merge of #6401 - ebroto:pin_to_a_nightly, r=ebroto
📌 Pin Clippy to a nightly 📌

changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy)

Addresses partially #5561. As proposed there in [this comment](https://github.com/rust-lang/rust-clippy/issues/5561#issuecomment-623109095), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`
2020-12-11 16:25:13 +00:00
Takayuki Nakata
26c61c7e49 Fix FP of manual_range_contains in const fn 2020-12-11 23:07:52 +09:00
bors
27fd6ed581 Auto merge of #6424 - Suyash458:master, r=flip1995
Add MSRV to more lints specified in #6097

add MSRV to more lints specified in #6097
add instructions for adding msrv in other lints
update tests

 - [x] `redundant_field_names` requires Rust 1.17 due to suggest feature stablized in that version.
 - [x] `redundant_static_lifetimes` requires Rust 1.17 due to suggest feature stablized in that version.
 - [x] `filter_map_next` requires Rust 1.30 due to suggest `Iterator::find_map`.
 - [x] `checked_conversions` requires Rust 1.34 due to suggest `TryFrom`.
 - [x] `match_like_matches_macro` requires Rust 1.42 due to suggest `matches!`. Addressed in #6201
 - [x] `manual_strip` requires Rust 1.45 due to suggest `str::{strip_prefix, strip_suffix}`. Addressed in #6201
 - [x] `option_as_ref_deref` requires Rust 1.40 due to suggest `Option::{as_deref, as_deref_mut}`. Addressed in #6201
 - [x] `manual_non_exhaustive` requires Rust 1.40 due to suggest `#[non_exhaustive]`. Addressed in #6201
 - [x] `manual_range_contains` requires Rust 1.35 due to suggest `Range*::contains`.
 - [x] `use_self` requires Rust 1.37 due to suggest `Self::Variant on enum`.
 - [x] `mem_replace_with_default` requires Rust 1.40 due to suggest `mem::take`.
 - [x] `map_unwrap_or` requires Rust 1.41 due to suggest `Result::{map_or, map_or_else}`.
 - [x] `missing_const_for_fn` requires Rust 1.46 due to `match/if/loop in const fn` needs that version.

changelog: Add MSRV config to more lints. ^This is now the complete list, AFAWK
2020-12-11 08:38:19 +00:00
Suyash458
9f27b74283 add test for missing_const_for_fn. fix test stderr 2020-12-11 11:00:29 +05:30
Suyash458
8df11e431b add instructions to include msrv in lints 2020-12-11 11:00:25 +05:30
suyash458
a7cfffef26 add MSRV to more lints specified in #6097
update tests
2020-12-11 11:00:03 +05:30
ThibsG
90a16e4397 Add tests for unsized trait in wrong_self_convention lint 2020-12-10 17:53:47 +01:00
Thibaud
1e0f85b264 Update tests/ui/use_self.rs
Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-12-10 17:08:42 +01:00
ThibsG
db98651e72 Allow wrong_self_convention in use_self test for trait def 2020-12-10 17:08:42 +01:00
ThibsG
4af9382bec Common function to lint wrong self convention from impl and trait def 2020-12-10 17:08:42 +01:00
ThibsG
a6bb9276f7 Lint wrong self convention in trait also 2020-12-10 17:08:42 +01:00
flip1995
836325e9d9
Fix integration test runner 2020-12-10 12:44:27 +01:00
flip1995
3f41fe2704
Error in integration test, if required toolchain is not installed 2020-12-10 12:44:27 +01:00
flip1995
26dcbf5523
Stop caching on CI
The only thing we now cache is cargo-cache, which we only use for cache.
That's a catch-22 if I ever seen one. And for Clippy itself we always
want to do a clean build and not cache anything.
2020-12-10 10:53:20 +01:00
flip1995
41cab83fdb
Fix toolchain installation in workflows 2020-12-10 10:53:19 +01:00
flip1995
20d84fdd98
Enable internal lints for every test in CI 2020-12-10 09:57:30 +01:00
Eduardo Broto
77a32ebe1e
Use new cache key 2020-12-10 09:57:30 +01:00
Eduardo Broto
2e8b00a331
Apply suggestions from PR review
Also:
  - Update to latest nightly
2020-12-10 09:57:29 +01:00
Eduardo Broto
613333acd5
Pin Clippy to a nightly 2020-12-10 09:57:29 +01:00
bors
6c70133faa Auto merge of #6218 - korrat:master, r=ebroto
Add lint for maps with zero-sized value types

Hi, this is my first time contributing to clippy or rust in general, so I'm not sure about the details of contributing. Please excuse me and let me now if I did anything wrong. I have a couple of questions:

1. I'm not sure what category this lint should be. I've put it in "nursery" for now.
1. Should I squash commits this is reviewed/merged?

changelog: Add lint for maps with zero-sized value types

Fixes #1641
2020-12-09 17:08:00 +00:00
Korrat
f77f1db35b Add a lint for maps with zero-sized values
Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-12-09 18:00:09 +01:00
bors
a2d99259a4 Auto merge of #6188 - ebroto:primary_package, r=flip1995
Add --no-deps option to avoid running on path dependencies in workspaces

Since rust-lang/cargo#8758 has hit nightly, this allows us to address the second bullet point and [the concern related to `--fix`](https://github.com/rust-lang/cargo/issues/8143#issuecomment-619289546) in the [RUSTC_WORKSPACE_WRAPPER tracking issue](https://github.com/rust-lang/cargo/issues/8143).

As a reminder stabilizing that env var will solve #4612 (Clippy not running after `cargo check` in stable) and would allow to stabilize the `--fix` option in Clippy.

changelog: Add `--no-deps` option to avoid running on path dependencies in workspaces

Fixes #3025
2020-12-09 15:37:20 +00:00
bors
b02b0c737a Auto merge of #6367 - justjosias:6348-print-stderr, r=ebroto
Add lint print_stderr

Resolves #6348
Almost identical to print_stdout, this lint applies to the `eprintln!` and `eprint!` macros rather than `println!` and `print!`.

changelog: Add new lint [`print_stderr`]. [`println_empty_string`] and [`print_with_newline`] now apply to `eprint!()` and `eprintln!()` respectively.
2020-12-08 22:22:49 +00:00
Eduardo Broto
3187cad8ec Factor out some code in write.rs
Get rid of the too-many-lines error.
2020-12-08 23:17:12 +01:00
bors
f9fccbedbf Auto merge of #6432 - giraffate:sync-from-rust, r=flip1995
Rustup

changelog: none
2020-12-08 08:11:41 +00:00
Takayuki Nakata
bd7f9c6c1c Merge remote-tracking branch 'upstream/master' into sync-from-rust 2020-12-08 17:01:25 +09:00
bors
50bca8af1d Auto merge of #6330 - camsteffen:redundant-else, r=ebroto
Add Redundant else lint

changelog: Add redundant_else lint

It seemed appropriate for "pedantic".

Closes #112 \*blows off dust*
2020-12-08 00:51:51 +00:00
bors
856f4f3af6 Auto merge of #6280 - dp304:assert_in_result_fn, r=ebroto
Add lint for assertions in functions returning Result

changelog: none
fixes #6082
2020-12-07 23:16:05 +00:00
Eduardo Broto
16d0e56924 Update reference file 2020-12-08 00:14:05 +01:00
dp304
bdad7900f4 Apply suggestions from code review
Use array slice instead of `Vec` in `find_macro_calls` as suggested by @ebroto

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
2020-12-08 00:10:39 +01:00
Dobe Peter
e58c7dd168 panic_in_result_fn: Extend to also check usages of [debug_]assert* macros
Also, the macro-finding logic has been moved to the util module, for
use by future lints.
2020-12-08 00:10:39 +01:00
Josias
7063c36c91 Add eprint! to print_with_newline lint 2020-12-07 23:38:56 +01:00
Josias
b04bfbd09b Fix print_stderr.stderr test 2020-12-07 23:38:56 +01:00
Josias
51cee15be0 Add negative tests 2020-12-07 23:38:56 +01:00
Josias
b81141cfb9 Add lint print_stderr
Resolves #6348
Almost identical to print_stdout, this lint applies to the
`eprintln!` and `eprint!` macros rather than `println!` and
`print!`.
2020-12-07 23:38:56 +01:00
bors
aaed9d9926 Auto merge of #6370 - giraffate:fix_fp_in_unnecessary_lazy_evaluations, r=llogiq,flip1995
Fix FP in `unnecessary_lazy_evaluations`

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

changelog: Fix FP in `unnecessary_lazy_evaluations`
2020-12-07 15:19:30 +00:00
Takayuki Nakata
ba1249465c cargo dev fmt 2020-12-07 16:45:10 +09:00
Takayuki Nakata
e90b977a08 Fix FP in unnecessary_lazy_evaluations 2020-12-07 16:42:43 +09:00
Tomasz Miąsko
0e527baf77 Retain assembly operands span when lowering AST to HIR 2020-12-06 20:48:08 +01:00
flip1995
8eca423ea1 Merge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyup 2020-12-06 15:01:03 +01:00