]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoadd manual_ok_or / pr remarks
Tim Nielens [Thu, 29 Oct 2020 18:08:54 +0000 (19:08 +0100)]
add manual_ok_or / pr remarks

3 years agoadd manual_ok_or lint
Tim Nielens [Tue, 27 Oct 2020 00:47:40 +0000 (01:47 +0100)]
add manual_ok_or lint

3 years agoAuto merge of #6225 - rust-lang:flip1995-patch-1, r=flip1995
bors [Sun, 25 Oct 2020 20:35:17 +0000 (20:35 +0000)]
Auto merge of #6225 - rust-lang:flip1995-patch-1, r=flip1995

Update triagebot.toml

r? `@ghost`
changelog: none

3 years agoUpdate triagebot.toml
Philipp Krones [Sun, 25 Oct 2020 20:34:46 +0000 (21:34 +0100)]
Update triagebot.toml

3 years agoAuto merge of #6202 - giraffate:fix_invalid_suggestion_in_needless_collect_test,...
bors [Sun, 25 Oct 2020 17:35:33 +0000 (17:35 +0000)]
Auto merge of #6202 - giraffate:fix_invalid_suggestion_in_needless_collect_test, r=flip1995

Fix an invalid suggestion in `needless_collect` test

A test, https://github.com/rust-lang/rust-clippy/blob/master/tests/ui/needless_collect_indirect.rs#L11-L12, suggests following codes, but the suggested codes don't work. An example is here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6947d9f2806a83f41cc5eb8e39b09d0b.
```
error: avoid using `collect()` when not needed
  --> $DIR/needless_collect_indirect.rs:11:5
   |
LL | /     let indirect_contains = sample.iter().collect::<VecDeque<_>>();
LL | |     indirect_contains.contains(&&5);
   | |____^
   |
help: Check if the original Iterator contains an element instead of collecting then checking
   |
LL |
LL |     sample.iter().any(|x| x == &&5);
```

changelog: none

3 years agoAuto merge of #6194 - giraffate:remove_an_extra_blank_line, r=flip1995
bors [Sun, 25 Oct 2020 17:15:42 +0000 (17:15 +0000)]
Auto merge of #6194 - giraffate:remove_an_extra_blank_line, r=flip1995

Remove an extra blank line in doc examples

It seems to be an extra blank line in doc example.

changelog: none

<img width="1141" alt="スクリーンショット 2020-10-19 10 32 21" src="https://user-images.githubusercontent.com/17407489/96392372-d0583200-11f6-11eb-9aab-f7e8f87eb04e.png">

3 years agoAuto merge of #6183 - cgm616:hex_bin_digit_grouping, r=flip1995
bors [Sun, 25 Oct 2020 16:40:14 +0000 (16:40 +0000)]
Auto merge of #6183 - cgm616:hex_bin_digit_grouping, r=flip1995

Hex bin digit grouping

This revives and updates an old pr (#3391) for the current API.

Closes #2538.

---

*Please keep the line below*
changelog: Add [`unusual_byte_groupings`] lint.

3 years agoAuto merge of #6224 - flip1995:rustup, r=flip1995
bors [Sun, 25 Oct 2020 15:45:12 +0000 (15:45 +0000)]
Auto merge of #6224 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sun, 25 Oct 2020 15:43:53 +0000 (16:43 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoIntegrate suggestions from code review
cgm616 [Sun, 25 Oct 2020 15:31:24 +0000 (11:31 -0400)]
Integrate suggestions from code review

3 years agoAdd test case
Takayuki Nakata [Sun, 25 Oct 2020 14:55:41 +0000 (23:55 +0900)]
Add test case

3 years agoFix an invalid suggestion in `needless_collect` test
Takayuki Nakata [Wed, 21 Oct 2020 13:33:41 +0000 (22:33 +0900)]
Fix an invalid suggestion in `needless_collect` test

3 years agoFix logic mistake
cgm616 [Sun, 25 Oct 2020 13:34:46 +0000 (09:34 -0400)]
Fix logic mistake

3 years agoRemove accidental test inclusion
cgm616 [Sun, 25 Oct 2020 13:19:58 +0000 (09:19 -0400)]
Remove accidental test inclusion

3 years agoAllow hex literals to pass w/ groups of 2
cgm616 [Sun, 25 Oct 2020 13:18:06 +0000 (09:18 -0400)]
Allow hex literals to pass w/ groups of 2

3 years agoAdd lint for unusually-grouped hex/binary literals
Florian Hartwig [Wed, 31 Oct 2018 16:14:55 +0000 (17:14 +0100)]
Add lint for unusually-grouped hex/binary literals

3 years agoAuto merge of #6222 - JohnTitor:redundant-local-def-id, r=flip1995
bors [Sun, 25 Oct 2020 11:58:51 +0000 (11:58 +0000)]
Auto merge of #6222 - JohnTitor:redundant-local-def-id, r=flip1995

Remove redundant `expect_local()` call

The field `owner` of `HirId` is `LocalDefId` and `hir_id.owner.to_def_id().expect_local()` is redundant. I wonder they were introduced in some rustups.

changelog: none

3 years agoAuto merge of #6211 - ThibsG:NeedlessBoolCfg, r=flip1995
bors [Sun, 25 Oct 2020 11:37:18 +0000 (11:37 +0000)]
Auto merge of #6211 - ThibsG:NeedlessBoolCfg, r=flip1995

No lint with `cfg!` and fix sugg for macro in `needless_bool` lint

Don't lint if `cfg!` macro is one of the operand.
Fix suggestion when the span originated from a macro, using `hir_with_macro_callsite`.

Fixes: #3973
changelog: none

3 years agoAuto merge of #6198 - montrivo:needless-lifetime, r=flip1995
bors [Sun, 25 Oct 2020 11:15:01 +0000 (11:15 +0000)]
Auto merge of #6198 - montrivo:needless-lifetime, r=flip1995

needless-lifetime / multiple where clause predicates regression

Closes #6159.

changelog: fix regression in needless-lifetimes

3 years agoAuto merge of #6177 - rust-lang:manual-range-contains, r=flip1995
bors [Sun, 25 Oct 2020 10:35:46 +0000 (10:35 +0000)]
Auto merge of #6177 - rust-lang:manual-range-contains, r=flip1995

New lint: manual-range-contains

This fixes #1110, at least for the contains-suggesting part.

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

changelog: new lint: manual-range-contains

3 years agoRemove redundant `expect_local()` call
Yuki Okushi [Sun, 25 Oct 2020 10:30:00 +0000 (19:30 +0900)]
Remove redundant `expect_local()` call

3 years agoAuto merge of #6103 - FrancisMurillo:mut_mutex_lock, r=flip1995
bors [Sun, 25 Oct 2020 10:16:23 +0000 (10:16 +0000)]
Auto merge of #6103 - FrancisMurillo:mut_mutex_lock, r=flip1995

Add lint for `&mut Mutex::lock`

Fixes #1765

changelog: Add lint [`mut_mutex_lock`] for `&mut Mutex::lock` and suggests using `&mut Mutex::get_mut` instead.

3 years agoAuto merge of #6162 - josephlr:empty-loop-no-std, r=flip1995
bors [Sun, 25 Oct 2020 09:56:16 +0000 (09:56 +0000)]
Auto merge of #6162 - josephlr:empty-loop-no-std, r=flip1995

Update empty_loop documentation/message.

Originally part of #6161, but now this PR only deals with `std` crates

This change:
  - Updates the `std` message .
  - Updates the docs to mention how the busy loops should be fixed
    - Gives examples of how to do this for `no_std` targets
  - Updates the tests/stderr files to test this change.

changelog: Update `empty_loop` lint documentation

3 years agoRollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov
Yuki Okushi [Sun, 25 Oct 2020 09:43:49 +0000 (18:43 +0900)]
Rollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov

Split out statement attributes changes from #78306

This is the same as PR https://github.com/rust-lang/rust/pull/78306, but `unused_doc_comments` is modified to explicitly ignore statement items (which preserves the current behavior).

This shouldn't have any user-visible effects, so it can be landed without lang team discussion.

---------
When the 'early' and 'late' visitors visit an attribute target, they
activate any lint attributes (e.g. `#[allow]`) that apply to it.
This can affect warnings emitted on sibiling attributes. For example,
the following code does not produce an `unused_attributes` for
`#[inline]`, since the sibiling `#[allow(unused_attributes)]` suppressed
the warning.

```rust
trait Foo {
    #[allow(unused_attributes)] #[inline] fn first();
    #[inline] #[allow(unused_attributes)] fn second();
}
```

However, we do not do this for statements - instead, the lint attributes
only become active when we visit the struct nested inside `StmtKind`
(e.g. `Item`).

Currently, this is difficult to observe due to another issue - the
`HasAttrs` impl for `StmtKind` ignores attributes for `StmtKind::Item`.
As a result, the `unused_doc_comments` lint will never see attributes on
item statements.

This commit makes two interrelated fixes to the handling of inert
(non-proc-macro) attributes on statements:

* The `HasAttr` impl for `StmtKind` now returns attributes for
  `StmtKind::Item`, treating it just like every other `StmtKind`
  variant. The only place relying on the old behavior was macro
  which has been updated to explicitly ignore attributes on item
  statements. This allows the `unused_doc_comments` lint to fire for
  item statements.
* The `early` and `late` lint visitors now activate lint attributes when
  invoking the callback for `Stmt`. This ensures that a lint
  attribute (e.g. `#[allow(unused_doc_comments)]`) can be applied to
  sibiling attributes on an item statement.

For now, the `unused_doc_comments` lint is explicitly disabled on item
statements, which preserves the current behavior. The exact locatiosn
where this lint should fire are being discussed in PR #78306

3 years agoChange from correctness to style and MaybeIncorrect instead of MachineApplicable
Francis Murillo [Sun, 18 Oct 2020 01:09:07 +0000 (09:09 +0800)]
Change from correctness to style and MaybeIncorrect instead of MachineApplicable

3 years agoUse `sugg_lint_and_help`
Francis Murillo [Sat, 10 Oct 2020 10:07:47 +0000 (18:07 +0800)]
Use `sugg_lint_and_help`

3 years agoInline is_mut_mutex_lock_call
Francis Murillo [Mon, 5 Oct 2020 03:44:54 +0000 (11:44 +0800)]
Inline is_mut_mutex_lock_call

3 years agoRun update_lints
Francis Murillo [Fri, 2 Oct 2020 23:53:45 +0000 (07:53 +0800)]
Run update_lints

3 years agoChange lint doc test
Francis Murillo [Fri, 2 Oct 2020 02:54:44 +0000 (10:54 +0800)]
Change lint doc test

3 years agoAuto merge of #6181 - cgm616:undropped-manually-drops, r=flip1995
bors [Sun, 25 Oct 2020 09:37:09 +0000 (09:37 +0000)]
Auto merge of #6181 - cgm616:undropped-manually-drops, r=flip1995

Add new lint for undropped ManuallyDrop values

Adds a new lint for the following code:

```rust
struct S;

impl Drop for S {
    fn drop(&mut self) {
        println!("drip drop");
    }
}

fn main() {
    // This will not drop the `S`!!!
    drop(std::mem::ManuallyDrop::new(S));
    unsafe {
        // This will.
        std::mem::ManuallyDrop::drop(&mut std::mem::ManuallyDrop::new(S));
    }
}
```

The inner value of a `ManuallyDrop` will not be dropped unless the proper, unsafe drop function is called on it. This lint makes sure that a user does not accidently use the wrong function and forget to drop a `ManuallyDrop` value.

Fixes #5581.

---

*Please keep the line below*
changelog: none

3 years agoAdd lint for `&mut Mutex::lock`
Francis Murillo [Fri, 2 Oct 2020 01:05:30 +0000 (09:05 +0800)]
Add lint for `&mut Mutex::lock`

3 years agoAuto merge of #6109 - patrickelectric:single_element_for_check, r=flip1995
bors [Sun, 25 Oct 2020 09:15:55 +0000 (09:15 +0000)]
Auto merge of #6109 - patrickelectric:single_element_for_check, r=flip1995

Add linter for a single element for loop

changelog: Fixes #1540, check for vectors that contain a single element in a for loop

3 years agoAuto merge of #6029 - Daniel-B-Smith:refcell_ref_await, r=flip1995
bors [Sun, 25 Oct 2020 08:54:27 +0000 (08:54 +0000)]
Auto merge of #6029 - Daniel-B-Smith:refcell_ref_await, r=flip1995

Add lint for holding RefCell Ref across an await

Fixes #6008

This introduces the lint await_holding_refcell_ref. For async functions, we iterate
over all types in generator_interior_types and look for `core::cell::Ref` or `core::cell::RefMut`. If we find one then we emit a lint.

Heavily cribs from: https://github.com/rust-lang/rust-clippy/pull/5439

changelog: introduce the await_holding_refcell_ref lint

3 years agoAuto merge of #6187 - geoffreycopin:master, r=ebroto
bors [Sat, 24 Oct 2020 23:29:49 +0000 (23:29 +0000)]
Auto merge of #6187 - geoffreycopin:master, r=ebroto

Lint unnecessary int-to-int and float-to-float casts

This is an implementation of a lint that detects unnecessary casts of number literals, as discussed here:
https://github.com/rust-lang/rust-clippy/issues/6116

---

changelog: lint unnecessary as-casts of literals when they could be written using literal syntax.

3 years agoAuto merge of #6190 - montrivo:manual_result_unwrap_or, r=ebroto
bors [Sat, 24 Oct 2020 23:09:14 +0000 (23:09 +0000)]
Auto merge of #6190 - montrivo:manual_result_unwrap_or, r=ebroto

manual_unwrap_or / support Result::unwrap_or

Implements partially #5923.

changelog: support Result::unwrap_or in manual_unwrap_or

3 years agoAuto merge of #6135 - cauebs:master, r=ebroto
bors [Sat, 24 Oct 2020 22:31:53 +0000 (22:31 +0000)]
Auto merge of #6135 - cauebs:master, r=ebroto

Add large_types_passed_by_value lint

Creates a new lint that checks for large function parameters passed by value. ~Types that are Copy were ignored, because I understand they are explicitly marked as being cheap (or just acceptable) to copy. Arrays were excluded from that restriction because they are always Copy, independently of the size, if the elements are Copy.~ Only Copy types are considered, because if a type is not Copy it cannot be dereferenced, as pointed out by `@ebroto,` and that would require analyzing the whole function body to check if the argument is moved somewhere else. `self` and `mut` parameters are also skipped.

I refactored `trivially_copy_pass_by_ref` and the new lint into a new `pass_by_ref_or_value` module, since both share most of their implementations, as was pointed out to me in #4499.

~Some questions that remain:~
~1. Should `self` be disregarded for this lint?~
~2. Should we special case types like Vec and String when suggesting changes? (to slices and &str)~
~3. What should be the default size limit?~
~4. Are there any special cases I'm missing?~

I ask the maintainers to add the `hacktoberfest-accepted` label if this PR is decent, even if there are some minor details to work out, but I do intend to stick around and finish the job.

Fixes #4499

changelog: Add new lint [`large_types_passed_by_value`]

3 years agoAdd large_types_passed_by_value lint
Cauê Baasch de Souza [Thu, 8 Oct 2020 05:17:32 +0000 (02:17 -0300)]
Add large_types_passed_by_value lint

Refactor trivially_copy_pass_by_ref and the new lint into pass_by_ref_or_value module

Update stderr of conf_unknown_key test

Rename lint to large_types_passed_by_value

Increase `pass_by_value_size_limit` default value to 256

Improve rules for `large_types_passed_by_value`

Improve tests for `large_types_passed_by_value`

Improve documentation for `large_types_passed_by_value`

Make minor corrections to pass_by_ref_or_value.rs suggested by clippy itself

Fix `large_types_passed_by_value` example and improve docs

pass_by_ref_or_value: Tweak check for mut annotation in params

large_types_passed_by_value: add tests for pub trait, trait impl and inline attributes

3 years agoFix inconsistencies in handling of inert attributes on statements
Aaron Hill [Fri, 23 Oct 2020 22:17:00 +0000 (18:17 -0400)]
Fix inconsistencies in handling of inert attributes on statements

When the 'early' and 'late' visitors visit an attribute target, they
activate any lint attributes (e.g. `#[allow]`) that apply to it.
This can affect warnings emitted on sibiling attributes. For example,
the following code does not produce an `unused_attributes` for
`#[inline]`, since the sibiling `#[allow(unused_attributes)]` suppressed
the warning.

```rust
trait Foo {
    #[allow(unused_attributes)] #[inline] fn first();
    #[inline] #[allow(unused_attributes)] fn second();
}
```

However, we do not do this for statements - instead, the lint attributes
only become active when we visit the struct nested inside `StmtKind`
(e.g. `Item`).

Currently, this is difficult to observe due to another issue - the
`HasAttrs` impl for `StmtKind` ignores attributes for `StmtKind::Item`.
As a result, the `unused_doc_comments` lint will never see attributes on
item statements.

This commit makes two interrelated fixes to the handling of inert
(non-proc-macro) attributes on statements:

* The `HasAttr` impl for `StmtKind` now returns attributes for
  `StmtKind::Item`, treating it just like every other `StmtKind`
  variant. The only place relying on the old behavior was macro
  which has been updated to explicitly ignore attributes on item
  statements. This allows the `unused_doc_comments` lint to fire for
  item statements.
* The `early` and `late` lint visitors now activate lint attributes when
  invoking the callback for `Stmt`. This ensures that a lint
  attribute (e.g. `#[allow(unused_doc_comments)]`) can be applied to
  sibiling attributes on an item statement.

For now, the `unused_doc_comments` lint is explicitly disabled on item
statements, which preserves the current behavior. The exact locatiosn
where this lint should fire are being discussed in PR #78306

3 years agoKeep separators in cast_size_32bits stderr
Geoffrey Copin [Sat, 24 Oct 2020 12:07:34 +0000 (14:07 +0200)]
Keep separators in cast_size_32bits stderr

3 years agomanual-unwrap-or / pr remarks, round 3
Tim Nielens [Sat, 24 Oct 2020 09:35:05 +0000 (11:35 +0200)]
manual-unwrap-or / pr remarks, round 3

3 years agoNo lint with `cfg!` and fix sugg for macro in `needless_bool` lint
ThibsG [Sat, 24 Oct 2020 07:31:32 +0000 (09:31 +0200)]
No lint with `cfg!` and fix sugg for macro in `needless_bool` lint

3 years agoKeep sign in int-to-float casts
Geoffrey Copin [Fri, 23 Oct 2020 21:40:57 +0000 (23:40 +0200)]
Keep sign in int-to-float casts

3 years agoRemove duplicate import of `Target`
Eduardo Broto [Fri, 23 Oct 2020 21:45:37 +0000 (23:45 +0200)]
Remove duplicate import of `Target`

3 years agoMerge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
Eduardo Broto [Fri, 23 Oct 2020 20:16:59 +0000 (22:16 +0200)]
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup

3 years agoAuto merge of #6206 - ebroto:rustup, r=ebroto
bors [Fri, 23 Oct 2020 16:58:39 +0000 (16:58 +0000)]
Auto merge of #6206 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Fri, 23 Oct 2020 12:37:17 +0000 (14:37 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoclippy_lints: Update empty_loop lint
Joe Richey [Sun, 11 Oct 2020 23:04:33 +0000 (16:04 -0700)]
clippy_lints: Update empty_loop lint

We also update the documentation to note that the remediations are
different for `std` and `no_std` crates.

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agoFix test file
Geoffrey Copin [Thu, 22 Oct 2020 22:04:27 +0000 (00:04 +0200)]
Fix test file

3 years agoAdd test case for negative literals
Geoffrey Copin [Thu, 22 Oct 2020 22:04:27 +0000 (00:04 +0200)]
Add test case for negative literals

3 years agoAddress review comments
Geoffrey Copin [Thu, 22 Oct 2020 21:53:50 +0000 (23:53 +0200)]
Address review comments

3 years agomanual-unwrap-or / pr remarks, round 2
Tim Nielens [Thu, 22 Oct 2020 21:39:59 +0000 (23:39 +0200)]
manual-unwrap-or / pr remarks, round 2

3 years agomanual-unwrap-or / pr remarks
Tim Nielens [Thu, 22 Oct 2020 20:46:10 +0000 (22:46 +0200)]
manual-unwrap-or / pr remarks

3 years agoFix clippy tests
varkor [Thu, 22 Oct 2020 12:23:14 +0000 (13:23 +0100)]
Fix clippy tests

3 years agoAuto merge of #6203 - giraffate:fix_link_to_labeled_issues, r=Manishearth
bors [Thu, 22 Oct 2020 07:37:02 +0000 (07:37 +0000)]
Auto merge of #6203 - giraffate:fix_link_to_labeled_issues, r=Manishearth

Fix links to labeled issues

These labels seems wrong.
- <https://github.com/rust-lang/rust-clippy/labels/L-crash%20%3Aboom%3A>
- <https://github.com/rust-lang/rust-clippy/labels/L-bug%20%3Abeetle%3A>

changelog: none

3 years agoNew lint: manual-range-contains
Andre Bogus [Thu, 15 Oct 2020 20:05:51 +0000 (22:05 +0200)]
New lint: manual-range-contains

3 years agoUpdate tests and add known problems to docs
cgm616 [Fri, 16 Oct 2020 20:20:03 +0000 (16:20 -0400)]
Update tests and add known problems to docs

3 years agoAdd new lint for undropped ManuallyDrop values
cgm616 [Fri, 16 Oct 2020 15:12:37 +0000 (11:12 -0400)]
Add new lint for undropped ManuallyDrop values

3 years agoFix links to labeled issues
Takayuki Nakata [Wed, 21 Oct 2020 23:51:03 +0000 (08:51 +0900)]
Fix links to labeled issues

3 years agoSeparate tests for each lint
Daniel Smith [Mon, 19 Oct 2020 16:07:04 +0000 (12:07 -0400)]
Separate tests for each lint

3 years agoMerge lints into one pass
Daniel Smith [Mon, 19 Oct 2020 16:06:43 +0000 (12:06 -0400)]
Merge lints into one pass

3 years agoConvert the await holding lints to correctness
Daniel Smith [Tue, 13 Oct 2020 17:20:01 +0000 (13:20 -0400)]
Convert the await holding lints to correctness

3 years agoMove refcell lint into shared module
Daniel Smith [Tue, 13 Oct 2020 17:15:45 +0000 (13:15 -0400)]
Move refcell lint into shared module

3 years agoMove existing lint into shared file
Daniel Smith [Tue, 13 Oct 2020 16:39:20 +0000 (12:39 -0400)]
Move existing lint into shared file

3 years agoAdd another test case
Daniel Smith [Mon, 28 Sep 2020 17:29:37 +0000 (13:29 -0400)]
Add another test case

3 years agoBetter naming post copy/paste
Daniel Smith [Mon, 28 Sep 2020 16:57:18 +0000 (12:57 -0400)]
Better naming post copy/paste

3 years agoupdate_lints
Daniel Smith [Thu, 10 Sep 2020 20:02:00 +0000 (16:02 -0400)]
update_lints

3 years agofmt
Daniel Smith [Thu, 10 Sep 2020 20:01:27 +0000 (16:01 -0400)]
fmt

3 years agoAdd lint for holding RefCell Ref across an await
Daniel Smith [Thu, 10 Sep 2020 19:53:36 +0000 (15:53 -0400)]
Add lint for holding RefCell Ref across an await

3 years agoAuto merge of #6193 - Ryan1729:add-more-LintStore-documentation, r=phansch
bors [Tue, 20 Oct 2020 09:38:38 +0000 (09:38 +0000)]
Auto merge of #6193 - Ryan1729:add-more-LintStore-documentation, r=phansch

Add more infomation about LintStore registration

Backstory: I somehow missed the fact that I needed to register a lint pass in order for it to run, and I spent some time confused until I figured it out. So I wanted to make it clear that a missing `register_(early|late)_pass` call is a likely cause of a lint not running.

changelog: none

3 years agoneedless-lifetime / multiple where clause predicates regression
Tim Nielens [Mon, 19 Oct 2020 22:38:13 +0000 (00:38 +0200)]
needless-lifetime / multiple where clause predicates regression

3 years agoAuto merge of #6167 - ThibsG:IdenticalArgumentsAssertEq3574, r=ebroto
bors [Mon, 19 Oct 2020 19:50:12 +0000 (19:50 +0000)]
Auto merge of #6167 - ThibsG:IdenticalArgumentsAssertEq3574, r=ebroto

Identical arguments on assert macro family

Lint when identical args are used on `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros.

Added to the lint `eq_op`.

Common functions added to `utils/higher.rs`

Fixes: #3574
Fixes: #4694
changelog: Lint on identical args when calling `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros

3 years agoSplit `eq_op` ui tests to avoid file limit error in CI
ThibsG [Mon, 19 Oct 2020 15:31:41 +0000 (17:31 +0200)]
Split `eq_op` ui tests to avoid file limit error in CI

3 years agoAuto merge of #6166 - achris:master, r=flip1995
bors [Mon, 19 Oct 2020 13:17:07 +0000 (13:17 +0000)]
Auto merge of #6166 - achris:master, r=flip1995

Suggest a compatible shell for setup-toolchain.sh

setup-toolchain.sh uses "[[" which is a bash builtin, but the guide
suggests running it with sh.  On Ubuntu, /bin/sh points to dash and
running the script fails.

---

*Please keep the line below*
changelog: none

3 years agotests: if_same_then_else2: Ignore single_element_loop lint
Patrick José Pereira [Sat, 3 Oct 2020 20:01:34 +0000 (17:01 -0300)]
tests: if_same_then_else2: Ignore single_element_loop lint

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
3 years agoAdd linter for a single element for loop
Patrick José Pereira [Sat, 3 Oct 2020 18:46:28 +0000 (15:46 -0300)]
Add linter for a single element for loop

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
3 years agoAuto merge of #6195 - giraffate:sync-from-rust, r=ebroto
bors [Mon, 19 Oct 2020 06:01:21 +0000 (06:01 +0000)]
Auto merge of #6195 - giraffate:sync-from-rust, r=ebroto

Rustup

I followed these steps: <https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md#fixing-build-failures-caused-by-rust>.

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into sync-from-rust
Takayuki Nakata [Mon, 19 Oct 2020 04:05:51 +0000 (13:05 +0900)]
Merge remote-tracking branch 'upstream/master' into sync-from-rust

3 years agoRemove an extra blank line in doc examples
Takayuki Nakata [Mon, 19 Oct 2020 01:34:01 +0000 (10:34 +0900)]
Remove an extra blank line in doc examples

3 years agoAdd more infomation about LintStore registration
Ryan Wiedemann [Sun, 18 Oct 2020 23:01:57 +0000 (17:01 -0600)]
Add more infomation about LintStore registration

Backstory: I somehow missed the fact that I needed to register a lint pass in order for it to run, and I spent some time confused until I figured it out. So I wanted to make it clear that a missing `register_(early|late)_pass` call is a likely cause of a lint not running.

3 years agomanual_unwrap_or / support Result::unwrap_or
Tim Nielens [Sat, 17 Oct 2020 23:11:59 +0000 (01:11 +0200)]
manual_unwrap_or / support Result::unwrap_or

3 years agoAuto merge of #6189 - ebroto:rustup, r=ebroto
bors [Sat, 17 Oct 2020 20:13:34 +0000 (20:13 +0000)]
Auto merge of #6189 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Sat, 17 Oct 2020 19:55:46 +0000 (21:55 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRollup merge of #77851 - exrook:split-btreemap, r=dtolnay
Yuki Okushi [Sat, 17 Oct 2020 19:11:07 +0000 (04:11 +0900)]
Rollup merge of #77851 - exrook:split-btreemap, r=dtolnay

BTreeMap: refactor Entry out of map.rs into its own file

btree/map.rs is approaching the 3000 line mark, splitting out the entry
code buys about 500 lines of headroom.

I've created this PR because the changes I've made in #77438 will push `map.rs` over the 3000 line limit and cause tidy to complain.

I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations.

Related: #60302

3 years agoAppease the almightly lord clippy, hallowed be thy name
Jacob Hughes [Sat, 17 Oct 2020 17:45:40 +0000 (13:45 -0400)]
Appease the almightly lord clippy, hallowed be thy name

3 years agoLint unnecessary int-to-int and float-to-float casts
Geoffrey Copin [Thu, 15 Oct 2020 22:22:35 +0000 (00:22 +0200)]
Lint unnecessary int-to-int and float-to-float casts

3 years agoAssert macro args extractor as a common function in higher
ThibsG [Fri, 16 Oct 2020 15:58:26 +0000 (17:58 +0200)]
Assert macro args extractor as a common function in higher

3 years agoAuto merge of #6123 - montrivo:less_concise_than, r=ebroto
bors [Fri, 16 Oct 2020 20:43:45 +0000 (20:43 +0000)]
Auto merge of #6123 - montrivo:less_concise_than, r=ebroto

add lint manual_unwrap_or

Implements partially #5923.

changelog: add lint manual_unwrap_or

3 years agoAuto merge of #6184 - ebroto:bump_cargo_metadata, r=ebroto
bors [Fri, 16 Oct 2020 20:20:05 +0000 (20:20 +0000)]
Auto merge of #6184 - ebroto:bump_cargo_metadata, r=ebroto

bump cargo_metadata version

changelog: none

r? `@ghost` (master broken)

3 years agoHandle ExprKind::ConstBlock on clippy
Santiago Pastorino [Tue, 6 Oct 2020 21:51:31 +0000 (18:51 -0300)]
Handle ExprKind::ConstBlock on clippy

3 years agobump cargo_metadata version
Eduardo Broto [Fri, 16 Oct 2020 20:11:37 +0000 (22:11 +0200)]
bump cargo_metadata version

3 years agoAuto merge of #6180 - flip1995:rustup, r=flip1995
bors [Fri, 16 Oct 2020 12:24:23 +0000 (12:24 +0000)]
Auto merge of #6180 - flip1995:rustup, r=flip1995

Update semver 0.10 -> 0.11

r? `@ghost,` blocking CI

changelog: none

3 years agoUpdate semver 0.10 -> 0.11
flip1995 [Fri, 16 Oct 2020 12:23:17 +0000 (14:23 +0200)]
Update semver 0.10 -> 0.11

3 years agoAuto merge of #6178 - josephlr:sync-from-rust, r=phansch
bors [Fri, 16 Oct 2020 07:45:42 +0000 (07:45 +0000)]
Auto merge of #6178 - josephlr:sync-from-rust, r=phansch

Sync from rust

Fix rustc breakage by running:
```rust
git subtree push -P src/tools/clippy git@github.com:josephlr/rust-clippy sync-from-rust
```
and then adding a commit that runs `cargo dev fmt`

---

changelog: none

3 years agoRun cargo dev fmt
Joe Richey [Fri, 16 Oct 2020 05:37:53 +0000 (22:37 -0700)]
Run cargo dev fmt

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agoRollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_sta...
Dylan DPC [Fri, 16 Oct 2020 00:10:09 +0000 (02:10 +0200)]
Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk

ICEs should always print the top of the query stack

see #76920

3 years agoRemove rustc_session::config::Config
est31 [Wed, 14 Oct 2020 16:42:13 +0000 (18:42 +0200)]
Remove rustc_session::config::Config

The wrapper type led to tons of target.target
across the compiler. Its ptr_width field isn't
required any more, as target_pointer_width
is already present in parsed form.

3 years agoAuto merge of #6173 - Lotterleben:docs-typo, r=ebroto
bors [Thu, 15 Oct 2020 00:24:39 +0000 (00:24 +0000)]
Auto merge of #6173 - Lotterleben:docs-typo, r=ebroto

README: sort en/disabling section, fix typos, add note

it took me a while to figure out why `cargo clippy -- -Aclippy::pedantic -Wclippy::items-after-statements` still showed me *all* the lints. At first I thought it was due to the missing spaces in the current example and I debugged that until I stumbled across an issue noting that you have to touch a random file or run `cargo clean` when you're running clippy repeatedly on an unchanged codebase. This PR is an attempt to save the next person some time and also structure the "Allowing/denying lints" section a bit more while we're at it.

---
*Please keep the line below*
changelog: none

3 years agoAuto merge of #6174 - upsuper-forks:transmute-ptr-to-ref-issue, r=Manishearth
bors [Wed, 14 Oct 2020 21:54:32 +0000 (21:54 +0000)]
Auto merge of #6174 - upsuper-forks:transmute-ptr-to-ref-issue, r=Manishearth

Add a known problem for transmute_ptr_to_ref lint

changelog: none

3 years agoAuto merge of #6175 - ebroto:fix_remark, r=ebroto
bors [Wed, 14 Oct 2020 21:31:15 +0000 (21:31 +0000)]
Auto merge of #6175 - ebroto:fix_remark, r=ebroto

Fix remark linting on checkboxes

changelog: none

r? `@ghost` since this is blocking CI

3 years agoFix remark linting on checkboxes
Eduardo Broto [Wed, 14 Oct 2020 21:26:48 +0000 (23:26 +0200)]
Fix remark linting on checkboxes