]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agofix map import to rustc_middle
Devin R [Mon, 30 Mar 2020 18:39:27 +0000 (14:39 -0400)]
fix map import to rustc_middle

4 years agodev update_lints
Devin R [Tue, 24 Mar 2020 02:20:51 +0000 (22:20 -0400)]
dev update_lints

4 years agofix internal clippy warnings
Devin R [Wed, 18 Mar 2020 23:53:22 +0000 (19:53 -0400)]
fix internal clippy warnings

4 years agochange visitor name to OppVisitor
Devin R [Wed, 18 Mar 2020 22:33:59 +0000 (18:33 -0400)]
change visitor name to OppVisitor

4 years agouse Visitor api to find Mutex::lock calls
Devin R [Wed, 18 Mar 2020 22:13:06 +0000 (18:13 -0400)]
use Visitor api to find Mutex::lock calls

4 years agoadd note about update-all-refs script, revert redundant pat to master
Devin R [Wed, 18 Mar 2020 19:28:57 +0000 (15:28 -0400)]
add note about update-all-refs script, revert redundant pat to master

4 years agomove closures to seperate fns, remove known problems
Devin R [Wed, 18 Mar 2020 19:20:01 +0000 (15:20 -0400)]
move closures to seperate fns, remove known problems

4 years agouse span_lint_and_help, cargo dev fmt
Devin R [Wed, 18 Mar 2020 01:51:43 +0000 (21:51 -0400)]
use span_lint_and_help, cargo dev fmt

4 years agocreating suggestion
Devin R [Thu, 5 Mar 2020 23:02:22 +0000 (18:02 -0500)]
creating suggestion

4 years agoprogress work on suggestion for auto fix
Devin R [Thu, 5 Mar 2020 13:36:19 +0000 (08:36 -0500)]
progress work on suggestion for auto fix

4 years agoAuto merge of #5141 - xiongmao86:issue5095, r=flip1995
bors [Sun, 19 Apr 2020 19:19:54 +0000 (19:19 +0000)]
Auto merge of #5141 - xiongmao86:issue5095, r=flip1995

Fixes issue 5095

fixes #5095.

- [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`

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

changelog: (internal) warn about collapsible `span_lint_and_then` calls.

4 years agoUpdate empty_enum.stderr
flip1995 [Sun, 19 Apr 2020 19:00:25 +0000 (21:00 +0200)]
Update empty_enum.stderr

4 years agoAuto merge of #5491 - smklein:borrowed_box, r=flip1995
bors [Sun, 19 Apr 2020 18:59:23 +0000 (18:59 +0000)]
Auto merge of #5491 - smklein:borrowed_box, r=flip1995

Fix issue #2907.

Update the "borrow box" lint to avoid recommending the following
conversion:

```
  // Old
  pub fn f(&mut Box<T>) {...}

  // New
  pub fn f(&mut T) {...}
```

Given a mutable reference to a box, functions may want to change
"which" object the Box is pointing at.

This change avoids recommending removing the "Box" parameter
for mutable references.

changelog: Don't trigger [`borrow_box`] lint on `&mut Box` references

4 years agoFormatting and naming
Philipp Krones [Sun, 19 Apr 2020 18:40:25 +0000 (20:40 +0200)]
Formatting and naming

4 years agoFormatting and naming
Philipp Krones [Sun, 19 Apr 2020 18:38:07 +0000 (20:38 +0200)]
Formatting and naming

4 years agoAuto merge of #5489 - phansch:node-id-hir-id, r=flip1995
bors [Sun, 19 Apr 2020 18:09:34 +0000 (18:09 +0000)]
Auto merge of #5489 - phansch:node-id-hir-id, r=flip1995

Cleanup: `node_id` -> `hir_id`

This removes some more `node_id` terminology from Clippy and replaces one occurrence of `as_local_node_id` with `as_local_hir_id`, which should be doing the same for that particular case.

changelog: none

4 years agoAuto merge of #5488 - phansch:future-not-send-ret-ty, r=flip1995
bors [Sun, 19 Apr 2020 17:50:33 +0000 (17:50 +0000)]
Auto merge of #5488 - phansch:future-not-send-ret-ty, r=flip1995

Cleanup: future_not_send: use `utils::return_ty` function

changelog: none

4 years agoAuto merge of #5490 - sinkuu:toplevel_ref_arg_for, r=phansch
bors [Sun, 19 Apr 2020 17:25:40 +0000 (17:25 +0000)]
Auto merge of #5490 - sinkuu:toplevel_ref_arg_for, r=phansch

Don't trigger toplevel_ref_arg for `for` loops

The lint suggests turning `for ref x in 0..10 {` into `for ref x in let x = &0..10; {`.

---

changelog: none

4 years agoCleanup: `node_id` -> `hir_id`
Philipp Hansch [Sun, 19 Apr 2020 12:19:11 +0000 (14:19 +0200)]
Cleanup: `node_id` -> `hir_id`

4 years agoFix issue #2907.
Sean Klein [Sun, 19 Apr 2020 14:49:12 +0000 (10:49 -0400)]
Fix issue #2907.

Update the "borrow box" lint to avoid recommending the following
conversion:

```
  // Old
  pub fn f(&mut Box<T>) {...}

  // New
  pub fn f(&mut T) {...}
```

Given a mutable reference to a box, functions may want to change
"which" object the Box is pointing at.

This change avoids recommending removing the "Box" parameter
for mutable references.

4 years agoDon't trigger toplevel_ref_arg for `for` loops
Shotaro Yamada [Sun, 19 Apr 2020 13:56:47 +0000 (22:56 +0900)]
Don't trigger toplevel_ref_arg for `for` loops

4 years agoCleanup: future_not_send: use `return_ty` method
Philipp Hansch [Sun, 19 Apr 2020 12:00:03 +0000 (14:00 +0200)]
Cleanup: future_not_send: use `return_ty` method

4 years agoAuto merge of #5486 - flip1995:badge_over, r=flip1995
bors [Sat, 18 Apr 2020 20:03:54 +0000 (20:03 +0000)]
Auto merge of #5486 - flip1995:badge_over, r=flip1995

Remove badge FIXME from Cargo.toml

cc https://github.com/rust-lang/crates.io/issues/2436

changelog: none

4 years agoRemove badge FIXME from Cargo.toml
flip1995 [Sat, 18 Apr 2020 20:02:14 +0000 (22:02 +0200)]
Remove badge FIXME from Cargo.toml

4 years agoChange note_span argument for span_lint_and_note.
xiongmao86 [Sat, 18 Apr 2020 10:29:36 +0000 (18:29 +0800)]
Change note_span argument for span_lint_and_note.

4 years agoAdd an Option<Span> argument to span_lint_and_help.
xiongmao86 [Sat, 18 Apr 2020 10:28:29 +0000 (18:28 +0800)]
Add an Option<Span> argument to span_lint_and_help.

4 years agoFixes internal lint warning in code base.
xiongmao86 [Fri, 17 Apr 2020 14:01:25 +0000 (22:01 +0800)]
Fixes internal lint warning in code base.

4 years agoImplement collapsible_span_lint_calls lint.
xiongmao86 [Fri, 17 Apr 2020 12:43:37 +0000 (20:43 +0800)]
Implement collapsible_span_lint_calls lint.

4 years agoAuto merge of #5427 - pmk21:implicit-sat-sub, r=flip1995
bors [Sat, 18 Apr 2020 09:05:41 +0000 (09:05 +0000)]
Auto merge of #5427 - pmk21:implicit-sat-sub, r=flip1995

Add lint named implicit_saturating_sub

Fixes: #5399
I've made a basic skeleton of the lint, would love more feedback on how to make it better.
changelog: Add lint [`implicit_saturating_sub`]

4 years agoPolished lint and tests
pmk21 [Fri, 17 Apr 2020 19:46:32 +0000 (01:16 +0530)]
Polished lint and tests

4 years agoAdded final lint and tests
pmk21 [Mon, 6 Apr 2020 18:10:41 +0000 (23:40 +0530)]
Added final lint and tests

4 years agoAdded basic lint and tests
pmk21 [Mon, 6 Apr 2020 18:07:57 +0000 (23:37 +0530)]
Added basic lint and tests

4 years agoAuto merge of #5483 - alex-700:fix-redundant-pattern-matching, r=flip1995
bors [Fri, 17 Apr 2020 19:29:17 +0000 (19:29 +0000)]
Auto merge of #5483 - alex-700:fix-redundant-pattern-matching, r=flip1995

fix redundant_pattern_matching lint

- now it handles `while let` case  (related to #5462)
- better suggestions in `if let` case

changelog: Fix suggestion in `redundant_pattern_matching` and also apply this lint to the `while let` case

4 years agofix redundant_pattern_matching lint
Aleksei Latyshev [Fri, 17 Apr 2020 10:53:13 +0000 (13:53 +0300)]
fix redundant_pattern_matching lint

- now it handles `while let` case
- better suggestions in `if let` case

4 years agoAuto merge of #5423 - rkuhn:add_futures_not_send, r=flip1995
bors [Fri, 17 Apr 2020 16:04:14 +0000 (16:04 +0000)]
Auto merge of #5423 - rkuhn:add_futures_not_send, r=flip1995

add lint futures_not_send

changelog: add lint futures_not_send

fixes #5379

~Remark: one thing that can (should?) still be improved is to directly include the error message from the `Send` check so that the programmer stays in the flow. Currently, getting the actual error message requires a restructuring of the code to make the `Send` constraint explicit.~
It now shows all unmet constraints for allowing the Future to be Send.

4 years agoAuto merge of #5445 - logan-dev-oss:master, r=flip1995
bors [Fri, 17 Apr 2020 14:15:28 +0000 (14:15 +0000)]
Auto merge of #5445 - logan-dev-oss:master, r=flip1995

Fixes issue #4892.

First contribution here 😊 ! Do not hesitate to correct me.

This PR is related to issue #4892 .

# Summary

```rust
-literal.method_call(args)
```
The main idea is to not trigger `clippy::precedence` when the method call is an odd function.

# Example

```rust
// should trigger lint
let _ = -1.0_f64.abs() //precedence of method call abs() and neg ('-') is ambiguous

// should not trigger lint
let _ = -1.0_f64.sin() // sin is an odd function => -sin(x) = sin(-x)
```

# Theory

Rust allows following literals:
- char
- string
- integers
- floats
- byte
- bool

Only integers/floats implements the relevant `std::ops::Neg`.
Following odd functions are implemented on i[8-128] and/or f[32-64]:
- `asin`
- `asinh`
- `atan`
- `atanh`
- `cbrt`
- `fract`
- `round`
- `signum`
- `sin`
- `sinh`
- `tan`
- `tanh `
- `to_degrees`
- `to_radians`

# Implementation

As suggested by `flip1995` in [comment](https://github.com/rust-lang/rust-clippy/issues/4892#issuecomment-568249683), this PR add a whitelist of odd functions and compare method call to the the whitelist before triggering lint.

changelog: Don't trigger [`clippy::precedence`] on odd functions.

4 years agoadd lint futures_not_send
Roland Kuhn [Tue, 7 Apr 2020 13:39:07 +0000 (15:39 +0200)]
add lint futures_not_send

4 years agoIntegrate more idiomatic rust changes.
logan-dev-oss [Fri, 17 Apr 2020 08:12:30 +0000 (10:12 +0200)]
Integrate more idiomatic rust changes.

4 years agoFix issue #4892.
logan-dev-oss [Fri, 10 Apr 2020 08:40:49 +0000 (10:40 +0200)]
Fix issue #4892.

4 years agoAuto merge of #5482 - phansch:diag, r=matthiaskrgr
bors [Fri, 17 Apr 2020 07:24:13 +0000 (07:24 +0000)]
Auto merge of #5482 - phansch:diag, r=matthiaskrgr

Cleanup: Rename 'db' variables to 'diag'

Did the same in rustc a while ago: https://github.com/rust-lang/rust/pull/65428

changelog: none

4 years agoAuto merge of #5481 - sinkuu:no_as_ref, r=phansch
bors [Fri, 17 Apr 2020 06:19:47 +0000 (06:19 +0000)]
Auto merge of #5481 - sinkuu:no_as_ref, r=phansch

question_mark: don't add `as_ref()` for a call expression

If a call returns a `!Copy` value, it does so regardless of whether `as_ref()` is added. For example, `foo.into_option().as_ref()?` can be simplified to `foo.into_option()?`.

---

changelog: Improved `question_mark` lint suggestion so that it doesn't add redundant `as_ref()`

4 years agocargo dev fmt
Philipp Hansch [Fri, 17 Apr 2020 06:09:09 +0000 (08:09 +0200)]
cargo dev fmt

4 years agoCleanup: Rename 'db' variable to 'diag'
Philipp Hansch [Fri, 17 Apr 2020 06:08:00 +0000 (08:08 +0200)]
Cleanup: Rename 'db' variable to 'diag'

4 years agoquestion_mark: don't add `as_ref()` for a call expression
Shotaro Yamada [Fri, 17 Apr 2020 04:09:02 +0000 (13:09 +0900)]
question_mark: don't add `as_ref()` for a call expression

4 years agoAuto merge of #5480 - sinkuu:unit_arg_app, r=flip1995
bors [Fri, 17 Apr 2020 01:40:59 +0000 (01:40 +0000)]
Auto merge of #5480 - sinkuu:unit_arg_app, r=flip1995

unit_arg suggestion is not really machine-applicable

This lint suggests replacing any code returining `()`-type with `()` literal, which can change the behavior. e.g. `Ok(do_something())` -> `OK(())`.

---

changelog: none

4 years agounit_arg suggestion may be incorrect
Shotaro Yamada [Fri, 17 Apr 2020 01:26:58 +0000 (10:26 +0900)]
unit_arg suggestion may be incorrect

4 years agoAuto merge of #5479 - matthiaskrgr:readme_auto_fix, r=flip1995
bors [Thu, 16 Apr 2020 21:41:14 +0000 (21:41 +0000)]
Auto merge of #5479 - matthiaskrgr:readme_auto_fix, r=flip1995

readme: update to cargo clippy --fix command

changelog: none

4 years agoAuto merge of #5476 - ThibsG:FixMatchesInExternalMacros, r=flip1995
bors [Thu, 16 Apr 2020 20:51:56 +0000 (20:51 +0000)]
Auto merge of #5476 - ThibsG:FixMatchesInExternalMacros, r=flip1995

Do not lint in macros for match lints

Don't lint in macros for match lints, more precisely in `check_pat` and `check_local` where it was not the case.

changelog: none

fixes: #5362

4 years agoAuto merge of #5475 - woshilapin:woshilapin-patch-1, r=flip1995
bors [Thu, 16 Apr 2020 20:29:19 +0000 (20:29 +0000)]
Auto merge of #5475 - woshilapin:woshilapin-patch-1, r=flip1995

[fix] Minor typo in GH Actions 'clippy_dev'

changelog: minor: fixes file name in Github Actions workflow `clippy_dev.yml`

I was looking for something else and ended up on that typo, just thought I would fix it.

4 years agoreadme: update to cargo clippy --fix command
Matthias Krüger [Thu, 16 Apr 2020 19:35:19 +0000 (21:35 +0200)]
readme: update to cargo clippy --fix command

4 years agoAuto merge of #5473 - Toxyxer:map-flatten-for-option, r=flip1995
bors [Thu, 16 Apr 2020 20:15:56 +0000 (20:15 +0000)]
Auto merge of #5473 - Toxyxer:map-flatten-for-option, r=flip1995

Map flatten for option

Fixes #5175

changelog:
- Trigger the map_flatten lint when map is called on an option
- Add test for such case

4 years agoAuto merge of #5474 - phansch:reenable-rustfmt, r=flip1995
bors [Thu, 16 Apr 2020 19:39:28 +0000 (19:39 +0000)]
Auto merge of #5474 - phansch:reenable-rustfmt, r=flip1995

Reenable rustfmt integration test

changelog: none

4 years agoAuto merge of #5478 - matthiaskrgr:apt_ci_debug_5477, r=phansch,flip1995
bors [Thu, 16 Apr 2020 19:23:11 +0000 (19:23 +0000)]
Auto merge of #5478 - matthiaskrgr:apt_ci_debug_5477, r=phansch,flip1995

 perform system upgrade fixes ci issue

Perhaps doing a system upgrade magically solves the problem?

changelog: none

4 years agoCI: performing system upgrade fixes broken apt deps on ubuntu 32bit
Matthias Krüger [Thu, 16 Apr 2020 18:24:51 +0000 (20:24 +0200)]
CI: performing system upgrade fixes broken apt deps on ubuntu 32bit

See #5477 for details

4 years agoDo not lint in macros for match lints
ThibsG [Fri, 27 Mar 2020 19:36:00 +0000 (20:36 +0100)]
Do not lint in macros for match lints

4 years ago[fix] Minor typo in GH Actions 'clippy_dev'
Jean SIMARD [Thu, 16 Apr 2020 11:51:37 +0000 (13:51 +0200)]
[fix] Minor typo in GH Actions 'clippy_dev'

4 years agoReenable rustfmt integration test
Philipp Hansch [Thu, 16 Apr 2020 11:17:06 +0000 (13:17 +0200)]
Reenable rustfmt integration test

4 years agoAdd test to map_flatten with an Option
Marcin Serwin [Wed, 15 Apr 2020 17:06:41 +0000 (19:06 +0200)]
Add test to map_flatten with an Option

4 years agoLint map_flatten if caller is an Option
Marcin Serwin [Wed, 15 Apr 2020 16:37:37 +0000 (18:37 +0200)]
Lint map_flatten if caller is an Option

4 years agoAuto merge of #5363 - yaahc:clippy-fix, r=phansch,flip1995
bors [Wed, 15 Apr 2020 22:38:42 +0000 (22:38 +0000)]
Auto merge of #5363 - yaahc:clippy-fix, r=phansch,flip1995

add --fix support to `cargo-clippy`

Prior to this we had started work on integrating clippy as a subcommand directly into cargo in the form of `cargo clippy-preview` and `cargo fix --clippy`. In the course of that work it was decided that the best approach would be to strictly add the features clippy needed to cargo in order to insert `clippy-driver` only for workspace crates. This was accomplished by adding a `RUSTC_WORKSPACE_WRAPPER` env variable to cargo that will override the normal `RUSTC_WRAPPER` when both are present and the current crate is a workspace crate.

This change adds support to clippy to use this by setting the `RUSTC_WORKSPACE_WRAPPER` env variable instead `RUSTC_WRAPPER` and by detecting `--fix` as an arg and swapping out the `check` cargo command for `fix` when it is present.

WIP, here are the current issues that I still need to resolve

- [x] Detect if we're running on nightly rust
  - [x] Set `RUSTC_WORKSPACE_WRAPPER` on nightly, and `RUSTC_WRAPPER` on stable
  - [x] Error out on stable when `--fix` is specified, because stable currently hasn't landed the PR for `RUSTC_WORKSPACE_WRAPPER` so if we set this it just runs check and silently fails
- [ ] Update the help text
  - [ ] The current plan is to shell out to `cargo check --help` and then postprocess the output to mention clippy instead of check where appropriate and to add the extra info about `--fix` and the `-- -A lint` options.
- [x] tests?

changelog: add `--fix` arg to `cargo-clippy`

4 years agoApply suggestions from code review
Jane Lusby [Wed, 15 Apr 2020 21:25:42 +0000 (14:25 -0700)]
Apply suggestions from code review

Co-Authored-By: Philipp Krones <hello@philkrones.com>
4 years agomanually fixing formatting at this point lol
Jane Lusby [Wed, 15 Apr 2020 20:08:33 +0000 (13:08 -0700)]
manually fixing formatting at this point lol

4 years agofmt
Jane Lusby [Wed, 15 Apr 2020 20:04:04 +0000 (13:04 -0700)]
fmt

4 years agorename field
Jane Lusby [Wed, 15 Apr 2020 19:31:40 +0000 (12:31 -0700)]
rename field

4 years agoAuto merge of #5470 - flip1995:rollup-cvkuiza, r=flip1995
bors [Wed, 15 Apr 2020 18:22:37 +0000 (18:22 +0000)]
Auto merge of #5470 - flip1995:rollup-cvkuiza, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5226 (Add lint for explicit deref and deref_mut method calls)
 - #5248 (Add lint on large non scalar const)
 - #5430 (Disallow bit-shifting in integer_arithmetic)
 - #5466 (large_enum_variant: Report sizes of variants)
 - #5468 (Zero single char names)

Failed merges:

r? @ghost

changelog: rollup

4 years agoRollup merge of #5468 - Toxyxer:zero-single-char-names, r=flip1995
Philipp Krones [Wed, 15 Apr 2020 18:12:31 +0000 (20:12 +0200)]
Rollup merge of #5468 - Toxyxer:zero-single-char-names, r=flip1995

Zero single char names

Fixes: #4086
changelog:
- Make the inequality strict

4 years agoRollup merge of #5466 - phansch:large-enum-variant-output, r=flip1995
Philipp Krones [Wed, 15 Apr 2020 18:12:30 +0000 (20:12 +0200)]
Rollup merge of #5466 - phansch:large-enum-variant-output, r=flip1995

large_enum_variant: Report sizes of variants

This reports the sizes of the largest and second-largest variants.

Closes #5459

changelog: `large_enum_variant`: Report the sizes of the largest and second-largest variants.

4 years agoRollup merge of #5430 - michaelsproul:integer-arithmetic, r=flip1995
Philipp Krones [Wed, 15 Apr 2020 18:12:29 +0000 (20:12 +0200)]
Rollup merge of #5430 - michaelsproul:integer-arithmetic, r=flip1995

Disallow bit-shifting in integer_arithmetic

Make the `integer_arithmetic` lint detect all the operations that are defined as being capable of overflow in the [Rust Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow), by also linting for bit-shifting operations (`<<`, `>>`).

changelog: Disallow bit-shifting in `integer_arithmetic`

4 years agoRollup merge of #5248 - ThibsG:ConstValues, r=flip1995
Philipp Krones [Wed, 15 Apr 2020 18:12:28 +0000 (20:12 +0200)]
Rollup merge of #5248 - ThibsG:ConstValues, r=flip1995

Add lint on large non scalar const

This PR adds the new lint `non_scalar_const` that aims to warn against `const` declaration of large arrays. For performance, because of inlining, large arrays should be preferably declared as `static`.

Note: i made this one to warn on all const arrays, whether they are in a body function or not. I don't know if this is really necessary, i could just reduce this lint to variables out of function scope.

Fixes: #400
changelog: add new lint for large non-scalar types declared as const

4 years agoRollup merge of #5226 - ThibsG:DerefExplicit1566, r=flip1995
Philipp Krones [Wed, 15 Apr 2020 18:12:27 +0000 (20:12 +0200)]
Rollup merge of #5226 - ThibsG:DerefExplicit1566, r=flip1995

Add lint for explicit deref and deref_mut method calls

This PR adds the lint `explicit_deref_method` that suggests replacing `deref()` and `deref_mut()` with `&*a` and `&mut *a`.

It doesn't lint inside macros.

This PR is the continuation of  #3258.

changelog: Add lint `explicit_deref_method`.

Fixes: #1566
4 years agoAuto merge of #5467 - matthiaskrgr:rustup_43, r=flip1995
bors [Wed, 15 Apr 2020 17:46:24 +0000 (17:46 +0000)]
Auto merge of #5467 - matthiaskrgr:rustup_43, r=flip1995

rustup https://github.com/rust-lang/rust/pull/71116

changelog: none

4 years agoRename dummy_hir_id -> parent_hir_id
Philipp Krones [Wed, 15 Apr 2020 17:46:05 +0000 (19:46 +0200)]
Rename dummy_hir_id -> parent_hir_id

4 years agorustup https://github.com/rust-lang/rust/pull/71116
Matthias Krüger [Wed, 15 Apr 2020 11:44:28 +0000 (13:44 +0200)]
rustup https://github.com/rust-lang/rust/pull/71116

4 years agorevert the damn fmt changes
Jane Lusby [Wed, 15 Apr 2020 16:22:45 +0000 (09:22 -0700)]
revert the damn fmt changes

4 years agoadd some tests
Jane Lusby [Wed, 15 Apr 2020 16:20:41 +0000 (09:20 -0700)]
add some tests

4 years agosplit it up for testing but the merge broke tests
Jane Lusby [Wed, 15 Apr 2020 16:06:57 +0000 (09:06 -0700)]
split it up for testing but the merge broke tests

4 years agoChange default many single char names threshold
Marcin Serwin [Wed, 15 Apr 2020 15:58:26 +0000 (17:58 +0200)]
Change default many single char names threshold

4 years agoMerge remote-tracking branch 'upstream/master' into clippy-fix
Jane Lusby [Wed, 15 Apr 2020 15:24:13 +0000 (08:24 -0700)]
Merge remote-tracking branch 'upstream/master' into clippy-fix

4 years agoBetter precedence case management + more tests
ThibsG [Sat, 21 Mar 2020 18:34:56 +0000 (19:34 +0100)]
Better precedence case management + more tests

4 years agoUse only check_expr with parent expr and precedence
ThibsG [Sat, 7 Mar 2020 14:33:27 +0000 (15:33 +0100)]
Use only check_expr with parent expr and precedence

4 years agoCheck for Deref trait impl + add fixed version
ThibsG [Tue, 25 Feb 2020 22:06:24 +0000 (23:06 +0100)]
Check for Deref trait impl + add fixed version

4 years agoReport using stmts and expr + tests
ThibsG [Sun, 26 Jan 2020 18:48:30 +0000 (19:48 +0100)]
Report using stmts and expr + tests

4 years agoGlobal rework + fix imports
ThibsG [Thu, 23 Jan 2020 15:28:01 +0000 (16:28 +0100)]
Global rework + fix imports

4 years agoWorking basic dereference clip
Tom Milligan [Wed, 3 Oct 2018 16:53:39 +0000 (17:53 +0100)]
Working basic dereference clip

4 years agoAdd test for zero single char names
Marcin Serwin [Wed, 15 Apr 2020 11:22:50 +0000 (13:22 +0200)]
Add test for zero single char names

4 years agoMake the single char threshold strict inequality
Marcin Serwin [Wed, 15 Apr 2020 11:22:28 +0000 (13:22 +0200)]
Make the single char threshold strict inequality

4 years agolarge_enum_variant: Report sizes of variants
Philipp Hansch [Wed, 15 Apr 2020 07:55:02 +0000 (09:55 +0200)]
large_enum_variant: Report sizes of variants

This reports the sizes of the largest and second-largest variants.

4 years agoAuto merge of #5464 - matthiaskrgr:dep_compiletest, r=phansch
bors [Wed, 15 Apr 2020 07:39:03 +0000 (07:39 +0000)]
Auto merge of #5464 - matthiaskrgr:dep_compiletest, r=phansch

deps: bump compiletest-rs from 0.4 to 0.5

changelog: none

4 years agoAuto merge of #5345 - Toxyxer:add-lint-for-float-in-array-comparison, r=flip1995
bors [Wed, 15 Apr 2020 06:39:11 +0000 (06:39 +0000)]
Auto merge of #5345 - Toxyxer:add-lint-for-float-in-array-comparison, r=flip1995

Add lint for float in array comparison

Fixes #4277
changelog:
- Added new handler for expression of index kind (e.g. `arr[i]`). It returns a constant when both array and index are constant, or when the array is constant and all values are equal.
- Trigger float_cmp and float_cmp_const lint when comparing arrays. Allow for comparison when one of the arrays contains only zeros or infinities.
- Added appropriate tests for such cases.

4 years agoAuto merge of #5452 - phansch:match_def_path_refactor, r=matthiaskrgr
bors [Wed, 15 Apr 2020 05:42:52 +0000 (05:42 +0000)]
Auto merge of #5452 - phansch:match_def_path_refactor, r=matthiaskrgr

Refactor: Use rustc's `match_def_path`

This replaces our match_def_path implementation with the rustc one.

Note that we can't just use it in all call sites because of the
`&[&str]` / `&[Symbol]` difference in Clippy/rustc.

changelog: none

4 years agoRefactor: Use rustc's `match_def_path`
Philipp Hansch [Sun, 12 Apr 2020 08:41:25 +0000 (10:41 +0200)]
Refactor: Use rustc's `match_def_path`

This replaces our match_def_path implementation with the rustc one.

Note that we can't just use it in all call sites because of the
`&[&str]` / `&[Symbol]` difference in Clippy/rustc.

4 years agoAuto merge of #5449 - phansch:diagnostic-items, r=matthiaskrgr
bors [Tue, 14 Apr 2020 19:58:17 +0000 (19:58 +0000)]
Auto merge of #5449 - phansch:diagnostic-items, r=matthiaskrgr

Make use of more diagnostic items

This makes use of some (not all) already existing diagnostic items. Specifically:

79982a2: `core::mem::uninitialized`, `core::mem::zeroed`, `alloc::sync::Arc`, `alloc::sync::Rc`
83874d0: `Option` and `Result`

cc #5393

changelog: none

4 years agoAuto merge of #5460 - phansch:fix_incorrect_tests, r=matthiaskrgr
bors [Tue, 14 Apr 2020 19:33:11 +0000 (19:33 +0000)]
Auto merge of #5460 - phansch:fix_incorrect_tests, r=matthiaskrgr

result_map_unit_fn: Fix incorrect UI tests

`x` and the `HasResult` struct were missing in this file.

changelog: none

4 years agodeps: bump compiletest-rs from 0.4 to 0.5
Matthias Krüger [Tue, 14 Apr 2020 19:29:23 +0000 (21:29 +0200)]
deps: bump compiletest-rs from 0.4 to 0.5

4 years agoAuto merge of #5457 - phansch:sym, r=matthiaskrgr
bors [Tue, 14 Apr 2020 12:30:14 +0000 (12:30 +0000)]
Auto merge of #5457 - phansch:sym, r=matthiaskrgr

Cleanup: Use our `sym!` macro more

It's much shorter than Symbol::intern and the effect should still be clear

---

changelog: none

4 years agoAuto merge of #5463 - matthiaskrgr:rustup_42, r=phansch
bors [Tue, 14 Apr 2020 12:18:02 +0000 (12:18 +0000)]
Auto merge of #5463 - matthiaskrgr:rustup_42, r=phansch

rustup https://github.com/rust-lang/rust/pull/70643

changelog: none

4 years agorustup https://github.com/rust-lang/rust/pull/70643
Matthias Krüger [Tue, 14 Apr 2020 10:25:45 +0000 (12:25 +0200)]
rustup https://github.com/rust-lang/rust/pull/70643

4 years agoAuto merge of #5453 - rabisg0:fix/redundant_clone, r=phansch
bors [Tue, 14 Apr 2020 05:59:26 +0000 (05:59 +0000)]
Auto merge of #5453 - rabisg0:fix/redundant_clone, r=phansch

Fixes #5405: redundant clone false positive with arrays

Check whether slice elements implement Copy before suggesting to drop
the clone method

changelog: add a check for slice indexing on redundant_clone lint

4 years agoAuto merge of #5458 - phansch:is-proc-macro-attr, r=matthiaskrgr
bors [Tue, 14 Apr 2020 05:31:03 +0000 (05:31 +0000)]
Auto merge of #5458 - phansch:is-proc-macro-attr, r=matthiaskrgr

Cleanup: Use rustc's is_proc_macro_attr

It's doing exactly the same: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast/expand/mod.rs.html#8-12

changelog: none

4 years agoAuto merge of #5448 - Emerentius:update_new_ret_no_self_docs, r=phansch
bors [Mon, 13 Apr 2020 20:32:44 +0000 (20:32 +0000)]
Auto merge of #5448 - Emerentius:update_new_ret_no_self_docs, r=phansch

Update documentation for new_ret_no_self

changelog: Update documentation for lint new_ret_no_self to reflect that the return type must only contain `Self`, not be `Self`

The lint was changed to be more lenient than the documentation implies in PR #3338 (Related issue #3313)