]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdapted the website search for better matching
xFrednet [Sat, 19 Dec 2020 16:12:36 +0000 (16:12 +0000)]
Adapted the website search for better matching

* Formatting

3 years agoAuto merge of #6471 - phansch:fix-bless, r=flip1995
bors [Sat, 19 Dec 2020 12:28:00 +0000 (12:28 +0000)]
Auto merge of #6471 - phansch:fix-bless, r=flip1995

Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious there. The shell script did a `-s` test which
reads the file as well.

changelog: internal: Fix `cargo dev bless` when new reference files are added

3 years agoFix blessing of new reference files
Philipp Hansch [Sat, 19 Dec 2020 07:25:42 +0000 (08:25 +0100)]
Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious. The shell script did a `-s` test which reads the
file.

3 years agoAuto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs,...
bors [Sat, 19 Dec 2020 07:35:04 +0000 (07:35 +0000)]
Auto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs, r=phansch

make needless_update ignore non_exhaustive structs

changelog: make `needless_update` lint ignore `non_exhaustive` structs

fixes #6323

3 years agoremove example
Andrew Houts [Sat, 19 Dec 2020 01:15:05 +0000 (19:15 -0600)]
remove example

3 years agoAuto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995
bors [Fri, 18 Dec 2020 22:40:08 +0000 (22:40 +0000)]
Auto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995

Renamed the good first issue label in CONTRIBUTING.md

Follow up from #6468

Grep found some more references to the old `good first issue`.

[CONTRIBUTING.md rendered](https://github.com/xFrednet/rust-clippy/blob/0000-rename-good-first-issue-in-docs/CONTRIBUTING.md)

<details>
<summary>grep output</summary>

```
$ grep -Ri "good first issue" rust-clippy/
rust-clippy/.git/COMMIT_EDITMSG:Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/HEAD:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000     commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/HEAD:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000     commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000  commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000  commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/CONTRIBUTING.md:Some issues are easier than others. The [`good first issue`] label can be used to find the easy issues.
rust-clippy/CONTRIBUTING.md:[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
rust-clippy/CONTRIBUTING.md:[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
```
</details>

---

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label in CONTRIBUTING.md
xFrednet [Fri, 18 Dec 2020 22:13:22 +0000 (22:13 +0000)]
Renamed the good first issue label in CONTRIBUTING.md

3 years agoAuto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995
bors [Fri, 18 Dec 2020 21:25:39 +0000 (21:25 +0000)]
Auto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995

Renamed the good first issue label for rustbot

The `good first issue` label got renamed to `good-first-issue`. See [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428379) to enable the assignment with rustbot.

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label for rustbot
xFrednet [Fri, 18 Dec 2020 21:18:15 +0000 (21:18 +0000)]
Renamed the good first issue label for rustbot

See https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428018

3 years agoAuto merge of #6465 - Suyash458:master, r=flip1995
bors [Fri, 18 Dec 2020 09:36:05 +0000 (09:36 +0000)]
Auto merge of #6465 - Suyash458:master, r=flip1995

add more lints to msrv docs

Fixes #6097

changelog: None

3 years agoAuto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth
bors [Fri, 18 Dec 2020 06:57:21 +0000 (06:57 +0000)]
Auto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth

needless_doctest_main: handle correctly parse errors

Before this change, finding an error when parsing a doctest would make Clippy exit without emitting an error. Now we properly catch a fatal error and ignore it.

Also, if a doctest specifies an edition in the info line, it will be used when parsing it.

changelog: needless_doctest_main: handle correctly parse errors

Fixes #6022

3 years agoadd more lints to msrv docs
Suyash458 [Fri, 18 Dec 2020 05:25:09 +0000 (10:55 +0530)]
add more lints to msrv docs

3 years agomake needless_update ignore non_exhaustive structs
Andrew Houts [Fri, 18 Dec 2020 03:09:55 +0000 (21:09 -0600)]
make needless_update ignore non_exhaustive structs

3 years agoApply suggestion from PR review
Eduardo Broto [Thu, 17 Dec 2020 14:24:44 +0000 (15:24 +0100)]
Apply suggestion from PR review

3 years agoAuto merge of #6461 - Dorumin:patch-1, r=Manishearth
bors [Thu, 17 Dec 2020 00:22:57 +0000 (00:22 +0000)]
Auto merge of #6461 - Dorumin:patch-1, r=Manishearth

Typo in create_dir doc comment

changelog: none

3 years agoTypo: std::fs::crate_dir -> std::fs::create_dir
Naughty [Wed, 16 Dec 2020 23:48:03 +0000 (20:48 -0300)]
Typo: std::fs::crate_dir -> std::fs::create_dir

3 years agoAuto merge of #6448 - mikerite:interning_defined_symbol, r=Manishearth
bors [Wed, 16 Dec 2020 08:18:38 +0000 (08:18 +0000)]
Auto merge of #6448 - mikerite:interning_defined_symbol, r=Manishearth

New internal lint: Interning defined symbol

New internal lint: interning_defined_symbol

changelog: none

3 years agoRemove unsafe code
Michael Wright [Wed, 16 Dec 2020 04:05:25 +0000 (06:05 +0200)]
Remove unsafe code

3 years agoneedless_doctest_main: add edition support
Eduardo Broto [Tue, 15 Dec 2020 23:14:47 +0000 (00:14 +0100)]
needless_doctest_main: add edition support

3 years agoHandle fatal errors when parsing doctests
Eduardo Broto [Tue, 15 Dec 2020 22:18:03 +0000 (23:18 +0100)]
Handle fatal errors when parsing doctests

3 years agoAuto merge of #6452 - matthiaskrgr:bump_nightly, r=flip1995
bors [Mon, 14 Dec 2020 17:23:51 +0000 (17:23 +0000)]
Auto merge of #6452 - matthiaskrgr:bump_nightly, r=flip1995

bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14

This should hopefully fix incremental compilation ICEs in rustc that I have encountered multiple times while working with the previously pinned nightly.

changelog: none

3 years agobump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14
Matthias Krüger [Mon, 14 Dec 2020 16:47:05 +0000 (17:47 +0100)]
bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14

This should hopefully fix incremental compilation ICEs from rustc that I have been encountering multiple times while working with the previous nightly.

3 years agoAuto merge of #6451 - giraffate:update_contributing_md, r=llogiq
bors [Mon, 14 Dec 2020 06:13:44 +0000 (06:13 +0000)]
Auto merge of #6451 - giraffate:update_contributing_md, r=llogiq

Fix links in CONTRIBUTING.md

Links is broken.

<img width="1219" alt="スクリーンショット 2020-12-14 11 58 19" src="https://user-images.githubusercontent.com/17407489/102035564-fc152400-3e03-11eb-91a7-6c04e120d72f.png">

changelog: none

3 years agoFix links in CONTRIBUTING.md
Takayuki Nakata [Mon, 14 Dec 2020 02:57:35 +0000 (11:57 +0900)]
Fix links in CONTRIBUTING.md

3 years agoAuto merge of #6435 - xFrednet:5552-false-positive-match-single-binding, r=ebroto
bors [Sun, 13 Dec 2020 21:28:38 +0000 (21:28 +0000)]
Auto merge of #6435 - xFrednet:5552-false-positive-match-single-binding, r=ebroto

Fixing a false positive for the `match_single_binding` lint #5552

This is a fix for a false positive in the `match_single_binding` lint when using `#[cfg()]` on a branch. It is sadly a bit hacky but maybe the best solution as rust removes the other branch from the AST before we can even validate it. This fix looks at the code snippet itself and returns if it includes another thick arrow `=>` besides the one matching arm we found. This can again cause false negatives if someone has the following code:
```rust
match x {
    // => <-- Causes a false negative
    _ => 1,
}
```

I thought about making the code more complex and maybe validating against other things like the `#[cfg()]` macro but I believe that this is the best solution. This has basically switched the issue from a false positive to a false negative in a very specific case.

I'm happy to make some changes if you have any suggestions 🙃.

---
Fixes #5552

changelog: Fixed a false positive in the `match_single_binding` lint with `#[cfg()]` macro

3 years agoRemoving false positive for the match_single_binding lint
xFrednet [Wed, 9 Dec 2020 12:25:45 +0000 (12:25 +0000)]
Removing false positive for the match_single_binding lint

* Applying suggested changes from the PR

3 years agoAuto merge of #6450 - matthiaskrgr:dont_format_local_repo, r=ebroto
bors [Sun, 13 Dec 2020 18:07:57 +0000 (18:07 +0000)]
Auto merge of #6450 - matthiaskrgr:dont_format_local_repo, r=ebroto

cargo dev fmt: don't format entire rustc repo if we ran ra_setup previously

It turns out that rustfmt sees a rustc repo that we pulled in as path dependency via `cargo dev ra-setup` as part of the tree and would try to format it :D

Of course we don't want this, so skip formatting if we see that we ran `ra-setup` previously.

changelog: none

3 years agocargo dev: rename ra-setup to ra_setup to be in line with the other commands
Matthias Krüger [Sun, 13 Dec 2020 16:01:44 +0000 (17:01 +0100)]
cargo dev: rename ra-setup to ra_setup to be in line with the other commands

3 years agoclippy dev fmt: don't format if we have a local rustc repo enabled as path dependency...
Matthias Krüger [Sun, 13 Dec 2020 14:49:48 +0000 (15:49 +0100)]
clippy dev fmt: don't format if we have a local rustc repo enabled as path dependency via cargo dev ra-setup.

rustfmt would try to format the entire rustc repo, probably because it sees it as a local dependency.

3 years agoNFC: clippy cargo dev: move generation of clap config into a function
Matthias Krüger [Sun, 13 Dec 2020 14:22:45 +0000 (15:22 +0100)]
NFC: clippy cargo dev: move generation of clap config into a function

3 years agoAuto merge of #6449 - matthiaskrgr:needless_borrow_ty, r=ebroto
bors [Sun, 13 Dec 2020 16:59:02 +0000 (16:59 +0000)]
Auto merge of #6449 - matthiaskrgr:needless_borrow_ty, r=ebroto

needless_borrow: print the type in the lint message

changelog: needless_borrow: print type in lint message

3 years agoAuto merge of #6443 - matthiaskrgr:clone_on_copy_type, r=ebroto
bors [Sun, 13 Dec 2020 16:47:33 +0000 (16:47 +0000)]
Auto merge of #6443 - matthiaskrgr:clone_on_copy_type, r=ebroto

clone_on_copy: show the type in the lint message

changelog: clone_on_copy: show the type in the lint message

3 years agoAuto merge of #6441 - ebroto:use_rustflags, r=flip1995
bors [Sun, 13 Dec 2020 16:37:31 +0000 (16:37 +0000)]
Auto merge of #6441 - ebroto:use_rustflags, r=flip1995

Pass Clippy args also trough RUSTFLAGS

This removes a hack (\_\_CLIPPY_HACKERY\_\_) to add another one :)

It allows this workflow to work:
```terminal
cargo clippy                             # warning: empty `loop {}` wastes CPU cycles
cargo clippy -- -A clippy::empty_loop    # no warnings emitted
```

Before this change the new flag was not taken into consideration in cargo's fingerprint and the warning was emitted again. I guess that ideally we could add a specific env var for compiler wrapper arguments, but in the meantime this should do the job.

changelog: Pass clippy arguments through RUSTFLAGS so that changing them will trigger a rebuild

r? `@flip1995`
cc `@ehuss` (I think this may count as another step towards stabilizing `RUSTC_WORKSPACE_WRAPPER` :smile:)

Fixes #5214 and avoids frustration for users unfamiliar with the issue

3 years agoAddress comments from PR review
Eduardo Broto [Sun, 13 Dec 2020 16:21:53 +0000 (17:21 +0100)]
Address comments from PR review

Also: enable tests for cargo-clippy

3 years agoPass Clippy args also trough RUSTFLAGS
Eduardo Broto [Fri, 11 Dec 2020 22:54:47 +0000 (23:54 +0100)]
Pass Clippy args also trough RUSTFLAGS

3 years agoneedless_borrow: print the type in the lint message
Matthias Krüger [Sun, 13 Dec 2020 14:17:47 +0000 (15:17 +0100)]
needless_borrow: print the type in the lint message

changelog: needless_borrow: print type in lint message

3 years agoAuto merge of #6442 - matthiaskrgr:clone-double-ref-ty, r=llogiq
bors [Sun, 13 Dec 2020 10:09:00 +0000 (10:09 +0000)]
Auto merge of #6442 - matthiaskrgr:clone-double-ref-ty, r=llogiq

clone_double_ref: print reference type in lint message

changelog: clone_double_ref: print the type of the reference in lint message

3 years agoRun 'cargo dev update_lints'
Michael Wright [Sun, 13 Dec 2020 04:46:08 +0000 (06:46 +0200)]
Run 'cargo dev update_lints'

3 years agoFix dogfood errors
Michael Wright [Sun, 13 Dec 2020 04:32:41 +0000 (06:32 +0200)]
Fix dogfood errors

3 years agoNew internal lint: interning_defined_symbol
Michael Wright [Sun, 13 Dec 2020 04:32:41 +0000 (06:32 +0200)]
New internal lint: interning_defined_symbol

3 years agoAuto merge of #6318 - camsteffen:article-description, r=Manishearth
bors [Sat, 12 Dec 2020 21:20:40 +0000 (21:20 +0000)]
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

3 years agoAuto merge of #6382 - giraffate:fix_fp_in_manual_range_contains_when_const_fn, r...
bors [Sat, 12 Dec 2020 21:09:20 +0000 (21:09 +0000)]
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`

3 years agoAuto merge of #6413 - phansch:bless, r=flip1995
bors [Sat, 12 Dec 2020 14:42:28 +0000 (14:42 +0000)]
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

3 years agoFeed the dog :dog2:
Philipp Hansch [Sat, 12 Dec 2020 14:14:54 +0000 (15:14 +0100)]
Feed the dog :dog2:

3 years agoImprove variable naming
Philipp Hansch [Thu, 10 Dec 2020 10:34:22 +0000 (11:34 +0100)]
Improve variable naming

3 years agoRewrite update-all-references bash scripts in Rust
Philipp Hansch [Wed, 2 Dec 2020 17:20:02 +0000 (18:20 +0100)]
Rewrite update-all-references bash scripts in Rust

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

    cargo dev bless

command.

cc #5394

3 years agoclone_on_copy: show the type in the lint message
Matthias Krüger [Sat, 12 Dec 2020 00:23:28 +0000 (01:23 +0100)]
clone_on_copy: show the type in the lint message

changelog: clone_on_copy: show the type in the lint message

3 years agoclone_double_ref: print reference type in lint message
Matthias Krüger [Sat, 12 Dec 2020 00:09:30 +0000 (01:09 +0100)]
clone_double_ref: print reference type in lint message

changelog: clone_double_ref: print the type of the reference in lint message

3 years agoAuto merge of #6401 - ebroto:pin_to_a_nightly, r=ebroto
bors [Fri, 11 Dec 2020 16:25:13 +0000 (16:25 +0000)]
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`

3 years agoFix FP of `manual_range_contains` in `const fn`
Takayuki Nakata [Wed, 25 Nov 2020 08:07:50 +0000 (17:07 +0900)]
Fix FP of `manual_range_contains` in `const fn`

3 years agoAuto merge of #6424 - Suyash458:master, r=flip1995
bors [Fri, 11 Dec 2020 08:38:19 +0000 (08:38 +0000)]
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

3 years agoadd test for missing_const_for_fn. fix test stderr
Suyash458 [Wed, 9 Dec 2020 11:09:33 +0000 (16:39 +0530)]
add test for missing_const_for_fn. fix test stderr

3 years agoadd instructions to include msrv in lints
Suyash458 [Tue, 8 Dec 2020 16:55:20 +0000 (22:25 +0530)]
add instructions to include msrv in lints

3 years agoadd MSRV to more lints specified in #6097
suyash458 [Sat, 5 Dec 2020 12:59:22 +0000 (04:59 -0800)]
add MSRV to more lints specified in #6097
update tests

3 years agoFix integration test runner
flip1995 [Thu, 10 Dec 2020 10:00:05 +0000 (11:00 +0100)]
Fix integration test runner

3 years agoError in integration test, if required toolchain is not installed
flip1995 [Thu, 10 Dec 2020 09:44:33 +0000 (10:44 +0100)]
Error in integration test, if required toolchain is not installed

3 years agoStop caching on CI
flip1995 [Thu, 10 Dec 2020 08:36:19 +0000 (09:36 +0100)]
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.

3 years agoFix toolchain installation in workflows
flip1995 [Thu, 10 Dec 2020 07:53:27 +0000 (08:53 +0100)]
Fix toolchain installation in workflows

3 years agoEnable internal lints for every test in CI
flip1995 [Thu, 10 Dec 2020 07:51:27 +0000 (08:51 +0100)]
Enable internal lints for every test in CI

3 years agoUse new cache key
Eduardo Broto [Wed, 9 Dec 2020 22:38:15 +0000 (23:38 +0100)]
Use new cache key

3 years agoApply suggestions from PR review
Eduardo Broto [Wed, 9 Dec 2020 16:20:38 +0000 (17:20 +0100)]
Apply suggestions from PR review

Also:
  - Update to latest nightly

3 years agoPin Clippy to a nightly
Eduardo Broto [Sun, 29 Nov 2020 17:08:47 +0000 (18:08 +0100)]
Pin Clippy to a nightly

3 years agoAuto merge of #6218 - korrat:master, r=ebroto
bors [Wed, 9 Dec 2020 17:08:00 +0000 (17:08 +0000)]
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

3 years agoAdd a lint for maps with zero-sized values
Korrat [Sat, 24 Oct 2020 14:48:10 +0000 (16:48 +0200)]
Add a lint for maps with zero-sized values

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agoAuto merge of #6188 - ebroto:primary_package, r=flip1995
bors [Wed, 9 Dec 2020 15:37:20 +0000 (15:37 +0000)]
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

3 years agoAuto merge of #6367 - justjosias:6348-print-stderr, r=ebroto
bors [Tue, 8 Dec 2020 22:22:49 +0000 (22:22 +0000)]
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.

3 years agoFactor out some code in write.rs
Eduardo Broto [Tue, 8 Dec 2020 22:17:12 +0000 (23:17 +0100)]
Factor out some code in write.rs

Get rid of the too-many-lines error.

3 years agoAuto merge of #6432 - giraffate:sync-from-rust, r=flip1995
bors [Tue, 8 Dec 2020 08:11:41 +0000 (08:11 +0000)]
Auto merge of #6432 - giraffate:sync-from-rust, r=flip1995

Rustup

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into sync-from-rust
Takayuki Nakata [Tue, 8 Dec 2020 08:01:25 +0000 (17:01 +0900)]
Merge remote-tracking branch 'upstream/master' into sync-from-rust

3 years agoAuto merge of #6330 - camsteffen:redundant-else, r=ebroto
bors [Tue, 8 Dec 2020 00:51:51 +0000 (00:51 +0000)]
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*

3 years agoAuto merge of #6280 - dp304:assert_in_result_fn, r=ebroto
bors [Mon, 7 Dec 2020 23:16:05 +0000 (23:16 +0000)]
Auto merge of #6280 - dp304:assert_in_result_fn, r=ebroto

Add lint for assertions in functions returning Result

changelog: none
fixes #6082

3 years agoUpdate reference file
Eduardo Broto [Mon, 7 Dec 2020 23:14:05 +0000 (00:14 +0100)]
Update reference file

3 years agoApply suggestions from code review
dp304 [Thu, 3 Dec 2020 22:07:24 +0000 (23:07 +0100)]
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>
3 years agopanic_in_result_fn: Extend to also check usages of [debug_]assert* macros
Dobe Peter [Sat, 31 Oct 2020 19:31:34 +0000 (20:31 +0100)]
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.

3 years agoAdd eprint! to print_with_newline lint
Josias [Fri, 4 Dec 2020 14:39:09 +0000 (15:39 +0100)]
Add eprint! to print_with_newline lint

3 years agoFix print_stderr.stderr test
Josias [Tue, 1 Dec 2020 10:29:49 +0000 (11:29 +0100)]
Fix print_stderr.stderr test

3 years agoAdd negative tests
Josias [Sun, 29 Nov 2020 08:55:47 +0000 (09:55 +0100)]
Add negative tests

3 years agoAdd lint print_stderr
Josias [Sun, 22 Nov 2020 18:02:57 +0000 (19:02 +0100)]
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!`.

3 years agoAuto merge of #6370 - giraffate:fix_fp_in_unnecessary_lazy_evaluations, r=llogiq...
bors [Mon, 7 Dec 2020 15:19:30 +0000 (15:19 +0000)]
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`

3 years agocargo dev fmt
Takayuki Nakata [Mon, 7 Dec 2020 07:45:10 +0000 (16:45 +0900)]
cargo dev fmt

3 years agoFix FP in `unnecessary_lazy_evaluations`
Takayuki Nakata [Sun, 22 Nov 2020 13:04:18 +0000 (22:04 +0900)]
Fix FP in `unnecessary_lazy_evaluations`

3 years agoRetain assembly operands span when lowering AST to HIR
Tomasz Miąsko [Fri, 27 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Retain assembly operands span when lowering AST to HIR

3 years agoMerge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyup
flip1995 [Sun, 6 Dec 2020 14:01:03 +0000 (15:01 +0100)]
Merge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyup

3 years agoAuto merge of #6421 - xFrednet:4176-unreadable-literal-lint-fractal-option, r=Manishearth
bors [Sun, 6 Dec 2020 07:18:33 +0000 (07:18 +0000)]
Auto merge of #6421 - xFrednet:4176-unreadable-literal-lint-fractal-option, r=Manishearth

Added a lint-fraction-readability flag to the configuration

This adds an option to disable the `unreadable_literal` lint for floats with a longer fraction. This allows users to write `0.100200300` without getting a warning. Fixes #4176

I have some open questions about this PR:
1. I've named the option `lint-fraction-readability` is this a good name or should I rename it to something else?
2. What should the default configuration value be?
    * The current default value is `true` as this was also the previous default.
3. Do I have to document this new option somewhere else or will it be extracted from the code comment?
4. The current fix option will also rewrite the fraction if the integer part violates the `unreadable_literal` lint it would otherwise also trigger the `inconsistent_digit_grouping` lint. Is this also okay?
    * `1.100200300` will be unaffected by the fix function
    * `100200300.100200300` will be effected and fixed to `100_200_300.100_200_300`

---

The project needed some getting used to but I'm happy with the result. A big thank you to `@flip1995` for giving me some pointers for this implementation and to everyone for the great introduction documentation!

---

changelog: Added the `unreadable-literal-lint-fractions` configuration to disable the `unreadable_literal` lint for fractions

3 years agoRenamed the configuraiton to unreadable-literal-lint-fractions
xFrednet [Sat, 5 Dec 2020 20:59:53 +0000 (20:59 +0000)]
Renamed the configuraiton to unreadable-literal-lint-fractions

3 years agoAuto merge of #6418 - flip1995:apple_wraps_mhm, r=llogiq
bors [Sat, 5 Dec 2020 08:42:21 +0000 (08:42 +0000)]
Auto merge of #6418 - flip1995:apple_wraps_mhm, r=llogiq

Turn unnecessary_wraps applicability to MaybeIncorrect

Fixes: #6417
changelog: Turn [`unnecessary_wraps`] applicability to `MaybeIncorrect`

3 years agoUpdated code for CI
xFrednet [Fri, 4 Dec 2020 22:05:52 +0000 (22:05 +0000)]
Updated code for CI

3 years agoAdded a lint-fraction-readability flag to the configuration
xFrednet [Fri, 4 Dec 2020 21:26:47 +0000 (21:26 +0000)]
Added a lint-fraction-readability flag to the configuration

3 years agoAuto merge of #6419 - giraffate:fix_a_style_of_texts_in_size_of_in_element_count...
bors [Fri, 4 Dec 2020 14:42:07 +0000 (14:42 +0000)]
Auto merge of #6419 - giraffate:fix_a_style_of_texts_in_size_of_in_element_count, r=flip1995

Fix a style of texts in `size_of_in_element_count`

Add missing ` to texts

changelog: none

3 years agoFix a style of texts in `size_of_in_element_count`
Takayuki Nakata [Fri, 4 Dec 2020 14:36:07 +0000 (23:36 +0900)]
Fix a style of texts in `size_of_in_element_count`

3 years agoTurn unnecessary_wraps applicability to MaybeIncorrect
flip1995 [Fri, 4 Dec 2020 09:01:09 +0000 (10:01 +0100)]
Turn unnecessary_wraps applicability to MaybeIncorrect

3 years agoAuto merge of #6416 - deg4uss3r:map_err_restricted, r=ebroto
bors [Fri, 4 Dec 2020 01:04:48 +0000 (01:04 +0000)]
Auto merge of #6416 - deg4uss3r:map_err_restricted, r=ebroto

Moved map_err_ignore to restriction and updated help message

This MR moves map_err_ignore lint from `pedantic` to the `restriction` category of lints and updates the help message to give the user an option to ignore the lint by naming the closure variable e.g. `.map_err(|_ignored| ...`

---

changelog: move map_err_ignore to restriction category

3 years agoAuto merge of #6394 - nico-abram:unsafe_sizeof_count_copies, r=ebroto
bors [Fri, 4 Dec 2020 00:43:00 +0000 (00:43 +0000)]
Auto merge of #6394 - nico-abram:unsafe_sizeof_count_copies, r=ebroto

Add lint size_of_in_element_count

Fixes #6381
changelog: Add lint to check for using size_of::<T> or size_of_val::<T> in the count parameter to ptr::copy or ptr::copy_nonoverlapping, which take a count of Ts (And not a count of bytes)

- \[X] Followed [lint naming conventions][lint_naming]
- \[X] Added passing UI tests (including committed `.stderr` file)
- \[ ] `cargo test` passes locally
- \[X] Executed `cargo dev update_lints`
- \[X] Added lint documentation
- \[X] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

Running `cargo test` locally fails with this error:

```
running 1 test
test fmt ... FAILED

failures:

---- fmt stdout ----
status: exit code: 1
stdout:
stderr: error: unable to unlink old fallback exe
error: caused by: Access is denied. (os error 5)

thread 'fmt' panicked at 'Formatting check failed. Run `cargo dev fmt` to update formatting.', tests\fmt.rs:32:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    fmt

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
```

But I did run `cargo dev fmt`

3 years agoAdded test to make sure ignoring the error with a named wildcard value works
Ricky [Fri, 4 Dec 2020 00:41:44 +0000 (19:41 -0500)]
Added test to make sure ignoring the error with a named wildcard value works

3 years agoAdd more functions to size_of_in_element_count
unknown [Tue, 1 Dec 2020 00:54:50 +0000 (21:54 -0300)]
Add more functions to size_of_in_element_count
Specifically ptr::{sub, wrapping_sub, add, wrapping_add, offset, wrapping_offset} and slice::{from_raw_parts, from_raw_parts_mut}
The lint now also looks for size_of calls through casts (Since offset takes an isize)

3 years agoRename unsafe_sizeof_count_copies to size_of_in_element_count
unknown [Thu, 3 Dec 2020 23:55:38 +0000 (20:55 -0300)]
Rename unsafe_sizeof_count_copies to size_of_in_element_count

Also fix review comments:
 - Use const arrays and iterate them for the method/function names
 - merge 2 if_chain's into one using a rest pattern
 - remove unnecessary unsafe block in test

And make the lint only point to the count expression instead of the entire function call

3 years agoRemove unnecessary unsafe_size_count_copies tests
unknown [Sun, 29 Nov 2020 17:32:11 +0000 (14:32 -0300)]
Remove unnecessary unsafe_size_count_copies tests

3 years agoMake the unsafe_sizeof_count_copies lint work with more functions
unknown [Sun, 29 Nov 2020 17:23:59 +0000 (14:23 -0300)]
Make the unsafe_sizeof_count_copies lint work with more functions
Specifically:
 - find std::ptr::write_bytes
 - find std::ptr::swap_nonoverlapping
 - find std::ptr::slice_from_raw_parts
 - find std::ptr::slice_from_raw_parts_mut
 - pointer_primitive::write_bytes

3 years agoMake the unsafe_sizeof_count_copies lint find copy_{from,to} method calls
unknown [Sun, 29 Nov 2020 04:47:32 +0000 (01:47 -0300)]
Make the unsafe_sizeof_count_copies lint find copy_{from,to} method calls

3 years agoAdd lint unsafe_sizeof_count_copies
unknown [Sat, 28 Nov 2020 01:44:02 +0000 (22:44 -0300)]
Add lint unsafe_sizeof_count_copies