]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #5864 - rust-lang:ci_debug, r=Manishearth
bors [Mon, 3 Aug 2020 17:53:35 +0000 (17:53 +0000)]
Auto merge of #5864 - rust-lang:ci_debug, r=Manishearth

Fix ui-cargo tests in CI

r? @ebroto

The `ui-toml` tests set the `CARGO_MANIFEST_DIR` var, but never reset it, so the `ui-cargo` tests used it also and then found a faulty `clippy.toml` file

changelog: none

3 years agoFix ui-cargo tests in CI
flip1995 [Mon, 3 Aug 2020 15:22:47 +0000 (17:22 +0200)]
Fix ui-cargo tests in CI

3 years agoAuto merge of #5843 - dima74:iter_skip_next.add-suggestion, r=phansch
bors [Wed, 29 Jul 2020 06:10:55 +0000 (06:10 +0000)]
Auto merge of #5843 - dima74:iter_skip_next.add-suggestion, r=phansch

Add suggestion for `iter_skip_next` lint

changelog: Add suggestion for [`iter_skip_next`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next) lint

3 years agoAuto merge of #5840 - flip1995:basics, r=phansch
bors [Wed, 29 Jul 2020 05:43:02 +0000 (05:43 +0000)]
Auto merge of #5840 - flip1995:basics, r=phansch

Basic instruction for new contributors

While answering a few questions to @AB1908, I realized, that our documentation could use some love. Especially the "Getting Started" part for new contributors. So I wrote together some instruction on how to get the toolchain and how to build and test Clippy.

[Rendered](https://github.com/flip1995/rust-clippy/blob/basics/doc/basics.md)

r? @phansch

changelog: none

3 years agoAuto merge of #5853 - flip1995:rustup, r=flip1995
bors [Wed, 29 Jul 2020 01:18:35 +0000 (01:18 +0000)]
Auto merge of #5853 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Wed, 29 Jul 2020 01:17:23 +0000 (03:17 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoclippy
Bastian Kauschke [Mon, 27 Jul 2020 19:17:28 +0000 (21:17 +0200)]
clippy

3 years agointroduce PredicateAtom
Bastian Kauschke [Wed, 8 Jul 2020 22:35:55 +0000 (00:35 +0200)]
introduce PredicateAtom

3 years agothis might be unqualified, but at least it's now quantified
Bastian Kauschke [Wed, 24 Jun 2020 15:40:28 +0000 (17:40 +0200)]
this might be unqualified, but at least it's now quantified

3 years agoclippy
Bastian Kauschke [Fri, 19 Jun 2020 08:22:25 +0000 (10:22 +0200)]
clippy

3 years agoAuto merge of #5850 - giraffate:chmod_utils_ats_utils, r=flip1995
bors [Mon, 27 Jul 2020 15:27:01 +0000 (15:27 +0000)]
Auto merge of #5850 - giraffate:chmod_utils_ats_utils, r=flip1995

Small fix: `chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

changelog: none

It looks like `clippy_lints/src/utils/ast_utils.rs` doesn't have to be an executable file.

3 years ago`chmod` 644 `clippy_lints/src/utils/ast_utils.rs`
Takayuki Nakata [Mon, 27 Jul 2020 13:27:54 +0000 (22:27 +0900)]
`chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

3 years agoAuto merge of #5820 - ThibsG:FixSuspiciousArithmeticImpl, r=flip1995
bors [Sun, 26 Jul 2020 19:48:17 +0000 (19:48 +0000)]
Auto merge of #5820 - ThibsG:FixSuspiciousArithmeticImpl, r=flip1995

Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` …

As discussed in #3215, the `suspicious_trait_impl` lint causes too many false positives, as it is complex to find out if binary operations are suspicious or not.

This PR restricts the number of binary operations to at most one, otherwise we don't lint.
This can be seen as very conservative, but at least FP can be reduced to bare minimum.

Fixes: #3215
changelog: limit the `suspicious_arithmetic_impl` lint to one binop, to avoid many FPs

3 years agoMerge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup
flip1995 [Sun, 26 Jul 2020 19:07:07 +0000 (21:07 +0200)]
Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup

3 years agoAuto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc
bors [Sun, 26 Jul 2020 17:50:54 +0000 (17:50 +0000)]
Auto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc

Fix FP `useless_conversion`

Fix #5833.

changelog: none

3 years agoFix FP `useless_conversion`
Takayuki Nakata [Sat, 25 Jul 2020 14:58:22 +0000 (23:58 +0900)]
Fix FP `useless_conversion`

Fix #5833.

3 years agoAdd suggestion for `iter_skip_next` lint
Dmitry Murzin [Sat, 25 Jul 2020 14:09:44 +0000 (17:09 +0300)]
Add suggestion for `iter_skip_next` lint

3 years agoAddress review comments
flip1995 [Fri, 24 Jul 2020 21:17:52 +0000 (23:17 +0200)]
Address review comments

3 years agoMention lint naming guidelines earlier
flip1995 [Fri, 24 Jul 2020 15:48:43 +0000 (17:48 +0200)]
Mention lint naming guidelines earlier

3 years agoAuto merge of #5829 - JohnTitor:epsilon, r=flip1995
bors [Thu, 23 Jul 2020 18:48:35 +0000 (18:48 +0000)]
Auto merge of #5829 - JohnTitor:epsilon, r=flip1995

Use `(std::)f64::EPSILON` in the examples as suggested in the lints

`float_cmp(_const)` suggests using `{f32|f64}::EPSILON` and it'd be great if the docs mentioned it.

changelog: none

3 years agoAuto merge of #5832 - rust-lang:update_usage_instr, r=Manishearth
bors [Thu, 23 Jul 2020 18:15:08 +0000 (18:15 +0000)]
Auto merge of #5832 - rust-lang:update_usage_instr, r=Manishearth

Update Usage section of README.md

Fixes #5826

changelog: none

3 years agoUpdate Usage section of README.md
Philipp Krones [Wed, 22 Jul 2020 16:07:33 +0000 (18:07 +0200)]
Update Usage section of README.md

3 years agoAdd documentation for basic Clippy hacking
flip1995 [Wed, 22 Jul 2020 14:39:58 +0000 (16:39 +0200)]
Add documentation for basic Clippy hacking

3 years agoAuto merge of #5830 - flip1995:rustup, r=flip1995
bors [Tue, 21 Jul 2020 22:10:04 +0000 (22:10 +0000)]
Auto merge of #5830 - flip1995:rustup, r=flip1995

trait_sel: only test predicates w/ no substs

r? @ghost
changelog: none

3 years agoUse `(std::)f64::EPSILON` in the examples as suggested in the lints
Yuki Okushi [Tue, 21 Jul 2020 20:23:55 +0000 (05:23 +0900)]
Use `(std::)f64::EPSILON` in the examples as suggested in the lints

3 years agotrait_sel: only test predicates w/ no substs
David Wood [Mon, 22 Jun 2020 12:22:45 +0000 (13:22 +0100)]
trait_sel: only test predicates w/ no substs

This commit modifies the `substitute_normalize_and_test_predicates`
query, renaming it to `impossible_predicates` and only checking
predicates which do not require substs. By making this change,
polymorphization doesn't have to explicitly support vtables.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAuto merge of #5824 - tmiasko:manually-drop-clone, r=Manishearth
bors [Mon, 20 Jul 2020 01:36:21 +0000 (01:36 +0000)]
Auto merge of #5824 - tmiasko:manually-drop-clone, r=Manishearth

Ignore not really redundant clones of ManuallyDrop

"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:

```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
    // Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
    let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
    // Now increase refcount, but don't drop new refcount either
    let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```

changelog: Ignore redundant clone lint for ManuallyDrop.

3 years agoIgnore not really redundant clones of ManuallyDrop
Tomasz Miąsko [Mon, 20 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Ignore not really redundant clones of ManuallyDrop

"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:

```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
    // Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
    let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
    // Now increase refcount, but don't drop new refcount either
    let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```

Ignore redundant clone lint for ManuallyDrop.

3 years agoAuto merge of #5800 - montrivo:bugfix/redundant_closure, r=matthiaskrgr
bors [Sun, 19 Jul 2020 22:54:29 +0000 (22:54 +0000)]
Auto merge of #5800 - montrivo:bugfix/redundant_closure, r=matthiaskrgr

redundant_closure_call - don't lint when used more than once

Fixes #3354.

changelog: fix redundant_closure_call false positive when closure called more than once

3 years agoredundant_closure_call - pr review
Tim Nielens [Sun, 19 Jul 2020 22:36:31 +0000 (00:36 +0200)]
redundant_closure_call - pr review

3 years agoredundant_closure_call - add support for shadowed closures
Tim Nielens [Sun, 19 Jul 2020 09:47:32 +0000 (11:47 +0200)]
redundant_closure_call - add support for shadowed closures

3 years agoredundant_closure_call - extract lint from misc_early.rs, adapt to LatePass
Tim Nielens [Sat, 18 Jul 2020 22:33:54 +0000 (00:33 +0200)]
redundant_closure_call - extract lint from misc_early.rs, adapt to LatePass

3 years agoredundant_closure_call - don't lint when used more than once
Tim Nielens [Tue, 14 Jul 2020 18:27:25 +0000 (20:27 +0200)]
redundant_closure_call - don't lint when used more than once

3 years agoFix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` lint
ThibsG [Sat, 18 Jul 2020 21:59:34 +0000 (23:59 +0200)]
Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` lint

3 years agoAuto merge of #5815 - JarredAllen:redundant_pattern_bugfix, r=flip1995
bors [Sat, 18 Jul 2020 14:43:36 +0000 (14:43 +0000)]
Auto merge of #5815 - JarredAllen:redundant_pattern_bugfix, r=flip1995

Redundant pattern bugfix

changelog: Fixes the bug reported #5766

3 years agoAuto merge of #5818 - flip1995:rustup, r=flip1995
bors [Sat, 18 Jul 2020 13:11:03 +0000 (13:11 +0000)]
Auto merge of #5818 - flip1995:rustup, r=flip1995

Rename TypeckTables to TypeckResults.

r? @ghost

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sat, 18 Jul 2020 13:06:44 +0000 (15:06 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #5817 - flip1995:rustup, r=flip1995
bors [Fri, 17 Jul 2020 19:41:39 +0000 (19:41 +0000)]
Auto merge of #5817 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

Preparation for emergency Clippyup to fix an ICE #5816

changelog: none

3 years agoFix sync fallout (fmt)
flip1995 [Fri, 17 Jul 2020 19:39:05 +0000 (21:39 +0200)]
Fix sync fallout (fmt)

3 years agoFix bug in lint
JarredAllen [Fri, 17 Jul 2020 17:40:01 +0000 (10:40 -0700)]
Fix bug in lint

3 years agoAdd test for correct behavior
JarredAllen [Fri, 17 Jul 2020 16:27:43 +0000 (09:27 -0700)]
Add test for correct behavior

3 years agoAuto merge of #5814 - giraffate:fix_typo, r=flip1995
bors [Fri, 17 Jul 2020 14:33:05 +0000 (14:33 +0000)]
Auto merge of #5814 - giraffate:fix_typo, r=flip1995

Fix typo

changelog: none

3 years agoFix typo
Takayuki Nakata [Fri, 17 Jul 2020 13:51:57 +0000 (22:51 +0900)]
Fix typo

3 years agoRename TypeckTables to TypeckResults.
Valentin Lazureanu [Fri, 17 Jul 2020 08:47:04 +0000 (08:47 +0000)]
Rename TypeckTables to TypeckResults.

3 years agoAuto merge of #5811 - JarredAllen:panic_multiple_args, r=phansch
bors [Fri, 17 Jul 2020 06:41:20 +0000 (06:41 +0000)]
Auto merge of #5811 - JarredAllen:panic_multiple_args, r=phansch

Panic multiple args

changelog: Fixes bug with `panic` lint reported in #5767. I also did the same changes to the lints for `todo`, `unimplemented` and `unreachable`, so those lints should now also detect calls to those macros with a message.

3 years agoAuto merge of #5810 - matthiaskrgr:typos_2, r=Manishearth
bors [Fri, 17 Jul 2020 02:08:22 +0000 (02:08 +0000)]
Auto merge of #5810 - matthiaskrgr:typos_2, r=Manishearth

fix typos (found by codespell)

changelog: none

3 years agofix typos (found by codespell)
Matthias Krüger [Thu, 16 Jul 2020 23:58:41 +0000 (01:58 +0200)]
fix typos (found by codespell)

3 years agoClean up dogfood fallout
JarredAllen [Thu, 16 Jul 2020 23:58:21 +0000 (16:58 -0700)]
Clean up dogfood fallout

3 years agoEnable detecting multiple-argument panics
JarredAllen [Thu, 16 Jul 2020 23:51:12 +0000 (16:51 -0700)]
Enable detecting multiple-argument panics

3 years agoAvoid storing `SymbolStr` in a struct.
Nicholas Nethercote [Mon, 13 Jul 2020 06:45:35 +0000 (16:45 +1000)]
Avoid storing `SymbolStr` in a struct.

It's intended only for very temporary use.

3 years agoAuto merge of #5807 - flip1995:changelog, r=yaahc
bors [Thu, 16 Jul 2020 19:38:57 +0000 (19:38 +0000)]
Auto merge of #5807 - flip1995:changelog, r=yaahc

Changelog

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

changelog: none

3 years agoAuto merge of #5806 - flip1995:deploy_beta_fix, r=phansch
bors [Thu, 16 Jul 2020 19:13:17 +0000 (19:13 +0000)]
Auto merge of #5806 - flip1995:deploy_beta_fix, r=phansch

Fix deploy script for beta deployment

Since the `beta/` directory already exists, we can't copy the complete `master` dir

changelog: none

3 years agoTypo: Change Log -> Changelog
flip1995 [Thu, 16 Jul 2020 13:40:13 +0000 (15:40 +0200)]
Typo: Change Log -> Changelog

3 years agoUpdate changelog to beta-1.46
flip1995 [Thu, 16 Jul 2020 13:34:41 +0000 (15:34 +0200)]
Update changelog to beta-1.46

3 years agoTrack tag files, before checking for the diff
flip1995 [Thu, 16 Jul 2020 12:42:13 +0000 (14:42 +0200)]
Track tag files, before checking for the diff

3 years agoFix deploy script for beta deployment
flip1995 [Thu, 16 Jul 2020 11:44:58 +0000 (13:44 +0200)]
Fix deploy script for beta deployment

Since the beta/ directory already exists, we can't copy the complete master dir

3 years agoAuto merge of #5804 - flip1995:backport_remerge, r=flip1995
bors [Thu, 16 Jul 2020 10:47:49 +0000 (10:47 +0000)]
Auto merge of #5804 - flip1995:backport_remerge, r=flip1995

Backport remerge rust-1.44.1

r? @ghost

changelog: none

3 years agoMerge remote-tracking branch 'upstream/rust-1.44.1' into backport_remerge
flip1995 [Thu, 16 Jul 2020 10:44:57 +0000 (12:44 +0200)]
Merge remote-tracking branch 'upstream/rust-1.44.1' into backport_remerge

3 years agoAuto merge of #5788 - Leulz:shadow-unrelated-fix-rhs, r=flip1995
bors [Wed, 15 Jul 2020 19:09:21 +0000 (19:09 +0000)]
Auto merge of #5788 - Leulz:shadow-unrelated-fix-rhs, r=flip1995

Removing RHS snippet from SHADOW_UNRELATED message.

Fixes #5703

I am not sure if I reinvented the wheel here, but I could not really find a snippet function that did this truncation, so I created the function. Please tell me if there was a more obvious way to do this, I am new here. :smile:

changelog: Truncates multi-line RHS in shadow_unrelated message if it has more than 5 lines.

3 years agoAuto merge of #5802 - flip1995:rustup, r=flip1995
bors [Wed, 15 Jul 2020 18:17:25 +0000 (18:17 +0000)]
Auto merge of #5802 - flip1995:rustup, r=flip1995

Rustup

r? @ghost
changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Wed, 15 Jul 2020 18:15:57 +0000 (20:15 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRemoving snippet from SHADOW_UNRELATED message.
Leo Meira Vital [Mon, 13 Jul 2020 04:57:19 +0000 (01:57 -0300)]
Removing snippet from SHADOW_UNRELATED message.

3 years agoWithOptConstParam::dummy -> WithOptConstParam::unknown
Bastian Kauschke [Wed, 15 Jul 2020 08:55:41 +0000 (10:55 +0200)]
WithOptConstParam::dummy -> WithOptConstParam::unknown

3 years agoimprove naming
Bastian Kauschke [Wed, 15 Jul 2020 08:50:54 +0000 (10:50 +0200)]
improve naming

3 years agoconst_eval_resolve
Bastian Kauschke [Thu, 2 Jul 2020 21:56:17 +0000 (23:56 +0200)]
const_eval_resolve

3 years agoRemove lots of `Symbol::as_str()` calls.
Nicholas Nethercote [Wed, 8 Jul 2020 10:03:37 +0000 (20:03 +1000)]
Remove lots of `Symbol::as_str()` calls.

In various ways, such as changing functions to take a `Symbol` instead
of a `&str`.

3 years agoAuto merge of #5798 - mikerite:fix-2277-2, r=yaahc
bors [Tue, 14 Jul 2020 17:23:31 +0000 (17:23 +0000)]
Auto merge of #5798 - mikerite:fix-2277-2, r=yaahc

Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

changelog: none

3 years agoAuto merge of #5793 - warner:5783-nth-zero-next, r=flip1995
bors [Tue, 14 Jul 2020 16:58:23 +0000 (16:58 +0000)]
Auto merge of #5793 - warner:5783-nth-zero-next, r=flip1995

improve advice in iter_nth_zero

fixes #5783

*Please keep the line below*
changelog:  For iter_nth_zero, the "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead.

3 years agoAuto merge of #5737 - Uriopass:unit-for-ord, r=flip1995
bors [Tue, 14 Jul 2020 16:32:25 +0000 (16:32 +0000)]
Auto merge of #5737 - Uriopass:unit-for-ord, r=flip1995

Reprise: new lint: Unintentional return of unit from closures expecting Ord

This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

Reprise of #5348 where I addressed all the comments there

changelog: add lint [`unit_return_expecting_ord`]

3 years agoformatting nits
Brian Warner [Tue, 14 Jul 2020 16:20:19 +0000 (09:20 -0700)]
formatting nits

3 years agonew lint: Returning unit from closures expecting Ord
Matthias Krüger [Mon, 30 Mar 2020 09:02:14 +0000 (11:02 +0200)]
new lint: Returning unit from closures expecting Ord

This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

reprise: rebase, update and address all concerns

3 years agoMerge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
flip1995 [Tue, 14 Jul 2020 12:59:59 +0000 (14:59 +0200)]
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup

3 years agoAuto merge of #5732 - bjorn3:patch-1, r=flip1995
bors [Tue, 14 Jul 2020 09:39:01 +0000 (09:39 +0000)]
Auto merge of #5732 - bjorn3:patch-1, r=flip1995

Rename collapsable_if fix suggestion to "collapse nested if block"

The name "try" is confusing when shown as quick fix by rust-analyzer

changelog: Rename `collapsable_if` fix suggestion to "collapse nested if block"

3 years agoAuto merge of #5773 - giraffate:repeat_once, r=flip1995
bors [Tue, 14 Jul 2020 09:13:58 +0000 (09:13 +0000)]
Auto merge of #5773 - giraffate:repeat_once, r=flip1995

Add a lint for `.repeat(1)`

changelog: New lint `repeat_once`

fix #3028.

3 years agoAdd test for `needless_range_loop` issue
Michael Wright [Tue, 14 Jul 2020 06:18:15 +0000 (08:18 +0200)]
Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

3 years agoUse `.is_some()` not `Some(_)`
Takayuki Nakata [Mon, 13 Jul 2020 23:08:13 +0000 (08:08 +0900)]
Use `.is_some()` not `Some(_)`

3 years agoimprove advice in iter_nth_zero
Brian Warner [Mon, 13 Jul 2020 17:33:25 +0000 (10:33 -0700)]
improve advice in iter_nth_zero

The "use .next()" replacement advice is on the last line of the code snippet,
where it is vulnerable to truncation. Display that advice at the beginning
instead.

closes #5783

3 years agoRename collapsable_if fix suggestion to "collapse nested if block"
bjorn3 [Fri, 19 Jun 2020 09:44:03 +0000 (11:44 +0200)]
Rename collapsable_if fix suggestion to "collapse nested if block"

The name "try" is confusing when shown as quick fix by rust-analyzer

3 years agoRefactoring to use `constant_context
Takayuki Nakata [Mon, 13 Jul 2020 15:11:10 +0000 (00:11 +0900)]
Refactoring to use `constant_context

Use `constant_context`, `.is_str()` and `builtin_index()` to simplify.

3 years agoAuto merge of #5792 - flip1995:rollup-torc1we, r=flip1995
bors [Mon, 13 Jul 2020 14:21:20 +0000 (14:21 +0000)]
Auto merge of #5792 - flip1995:rollup-torc1we, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5443 (Some accuracy lints for floating point operations)
 - #5752 (Move range_minus_one to pedantic)
 - #5756 (unnecessary_sort_by: avoid linting if key borrows)
 - #5784 (Fix out of bounds access by checking length equality BEFORE accessing by index.)
 - #5786 (fix phrase in new_lint issue template)

Failed merges:

r? @ghost

changelog: rollup

3 years agoRollup merge of #5786 - matthiaskrgr:new_lint_issue_templ, r=phansch
Philipp Krones [Mon, 13 Jul 2020 13:59:46 +0000 (15:59 +0200)]
Rollup merge of #5786 - matthiaskrgr:new_lint_issue_templ, r=phansch

fix phrase in new_lint issue template

changelog: none

3 years agoRollup merge of #5784 - matthiaskrgr:ice_5780, r=phansch
Philipp Krones [Mon, 13 Jul 2020 13:59:45 +0000 (15:59 +0200)]
Rollup merge of #5784 - matthiaskrgr:ice_5780, r=phansch

Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes #5780

changelog: fix out of bounds access in unnested_or_patterns lint.

Edit: I did not bother reducing a testcase from `librustc_typeck` crate but I can confirm that with the change the crash no longer occurs.

3 years agoRollup merge of #5756 - ebroto:5754_sort_by, r=flip1995
Philipp Krones [Mon, 13 Jul 2020 13:59:44 +0000 (15:59 +0200)]
Rollup merge of #5756 - ebroto:5754_sort_by, r=flip1995

unnecessary_sort_by: avoid linting if key borrows

changelog: Avoid linting if key borrows in [`unnecessary_sort_by`]

Fixes #5754
Closes #2313

3 years agoRollup merge of #5752 - chrisduerr:pedantic_ranges, r=flip1995
Philipp Krones [Mon, 13 Jul 2020 13:59:42 +0000 (15:59 +0200)]
Rollup merge of #5752 - chrisduerr:pedantic_ranges, r=flip1995

Move range_minus_one to pedantic

This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see #3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.

*Please keep the line below*
changelog: move [`range_minus_one`] to pedantic

3 years agoRollup merge of #5443 - thiagoarrais:issue-2040, r=flip1995
Philipp Krones [Mon, 13 Jul 2020 13:59:41 +0000 (15:59 +0200)]
Rollup merge of #5443 - thiagoarrais:issue-2040, r=flip1995

Some accuracy lints for floating point operations

This will add some lints for accuracy on floating point operations suggested by @clarfon in #2040 (fixes #2040).

These are the remaining lints:

- [x] x.powi(2) => x * x
- [x] x.logN() / y.logN() => x.logbase(y)
- [x] x.logbase(E) => x.log()
- [x] x.logbase(10) => x.log10()
- [x] x.logbase(2) => x.log2().
- [x] x * PI / 180 => x.to_radians()
- [x] x * 180 / PI => x.to_degrees()
- [x] (x + 1).log() => x.log_1p()
- [x] sqrt(x * x + y * y) => x.hypot(y)

changelog: Included some accuracy lints for floating point operations

3 years agoAuto merge of #5790 - flip1995:rustup, r=flip1995
bors [Mon, 13 Jul 2020 13:53:11 +0000 (13:53 +0000)]
Auto merge of #5790 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

changelog: none

3 years agofix phrase in new_lint issue template
Matthias Krüger [Sat, 11 Jul 2020 21:42:56 +0000 (23:42 +0200)]
fix phrase in new_lint issue template

3 years agoRollup merge of #72920 - oli-obk:const_transmute, r=RalfJung
Manish Goregaokar [Sat, 11 Jul 2020 15:53:06 +0000 (08:53 -0700)]
Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung

Stabilize `transmute` in constants and statics but not const fn

cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)

Previous attempt: #64011

r? @RalfJung

cc @rust-lang/wg-const-eval

3 years agoFix out of bounds access by checking length equality BEFORE accessing by index.
Matthias Krüger [Sat, 11 Jul 2020 10:28:21 +0000 (12:28 +0200)]
Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes #5780

3 years agoStabilize `transmute` in constants and statics but not const fn
Oliver Scherer [Fri, 30 Aug 2019 00:01:04 +0000 (02:01 +0200)]
Stabilize `transmute` in constants and statics but not const fn

3 years agoAuto merge of #5769 - robojumper:match_like_matches_macro, r=phansch
bors [Fri, 10 Jul 2020 18:10:08 +0000 (18:10 +0000)]
Auto merge of #5769 - robojumper:match_like_matches_macro, r=phansch

new lint: match_like_matches_macro

Suggests using the `matches!` macro from `std` where appropriate.

`redundant_pattern_matching` has been moved into the `matches` pass to allow suppressing the suggestion where `is_some` and friends are a better replacement.

changelog: new lint: `match_like_matches_macro`

3 years agoFix tests a bit more
Christian Duerr [Fri, 10 Jul 2020 15:53:01 +0000 (17:53 +0200)]
Fix tests a bit more

3 years agoFix test failures
Christian Duerr [Fri, 10 Jul 2020 15:23:03 +0000 (17:23 +0200)]
Fix test failures

3 years agoFix typo
Takayuki Nakata [Fri, 10 Jul 2020 14:53:15 +0000 (23:53 +0900)]
Fix typo

3 years agoRun update_lints
Christian Duerr [Fri, 3 Jul 2020 19:09:32 +0000 (21:09 +0200)]
Run update_lints

3 years agoMove range_minus_one to pedantic
Christian Duerr [Fri, 26 Jun 2020 15:03:10 +0000 (17:03 +0200)]
Move range_minus_one to pedantic

This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see #3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.

3 years agoAvoid "whitelist"
Tamir Duberstein [Tue, 7 Jul 2020 15:12:44 +0000 (11:12 -0400)]
Avoid "whitelist"

Other terms are more inclusive and precise.

3 years agoAuto merge of #5781 - giraffate:fix_a_broken_link, r=phansch
bors [Thu, 9 Jul 2020 18:21:44 +0000 (18:21 +0000)]
Auto merge of #5781 - giraffate:fix_a_broken_link, r=phansch

Fix a broken link in CONTRIBUTING.md

changelog: none

3 years agoFix a broken link in CONTRIBUTING.md
Takayuki Nakata [Thu, 9 Jul 2020 13:07:15 +0000 (22:07 +0900)]
Fix a broken link in CONTRIBUTING.md

3 years agoAuto merge of #5771 - montrivo:bugfix/single-match-else, r=matthiaskrgr
bors [Thu, 9 Jul 2020 12:03:14 +0000 (12:03 +0000)]
Auto merge of #5771 - montrivo:bugfix/single-match-else, r=matthiaskrgr

single_match_else - single expr/stmt else block corner case

One approach to fix #3489.
See discussion in the issue.

changelog: single_match_else - single expr/stmt else block corner case fix