Commit graph

1972 commits

Author SHA1 Message Date
Unknown
50c82e0270 Updating to just warn for one test. 2019-02-01 13:21:19 -05:00
Unknown
c1f4e18453 Adding back tests, but also reducing threshold by 1 2019-02-01 13:21:19 -05:00
Unknown
3a97b5fa20 Moving tests to ui-toml to make use of clippy.toml 2019-02-01 13:21:19 -05:00
Unknown
6b86c3b1e7 Updating number of lines for the failing test to be > 100.
Due to updating the configuration to be 101 instead of 51
2019-02-01 13:21:19 -05:00
Araam Borhanian
1169066a0b Adding lint for too many lines. 2019-02-01 13:21:19 -05:00
Philipp Hansch
ec261a28f0
Rustup: unused trim result 2019-01-31 08:27:04 +01:00
Alex Hamilton
efaed8e0c0 wildcard_match_arm: lint only enum matches. 2019-01-29 15:33:04 -06:00
Alex Hamilton
c676578097 wildcard_match_arm: update ui test stderr 2019-01-29 15:33:04 -06:00
Alex Hamilton
c7ae44c0e2 wildcard_match_arm: format test. 2019-01-29 15:33:04 -06:00
Alex Hamilton
068924198b wildcard_match_arm: add simple ui test. 2019-01-29 15:33:04 -06:00
bors
6b1a2a9c3e Auto merge of #3648 - phansch:const_fn_lint, r=oli-obk
Add initial version of const_fn lint

This adds an initial version of a lint that can tell if a function could be `const`.

TODO:

- [x] Finish up the docs
- [x] Fix the ICE

cc #2440
2019-01-29 19:58:13 +00:00
Philipp Hansch
aed001b8d4
Update various docs
* `const_transmute` currently also seems to depend on the `const_fn`
  feature.
* Only `Sized` is currently allowed as a bound, not Copy.
2019-01-29 08:19:05 +01:00
Philipp Hansch
0c6bdda562
Use built-in entry_fn detection over self-built 2019-01-29 08:19:05 +01:00
Philipp Hansch
c0a02691d8
cargo fmt 2019-01-29 08:19:05 +01:00
Philipp Hansch
f9d65b6356
Reorganize conditionals: Run faster checks first 2019-01-29 08:19:05 +01:00
Philipp Hansch
c3980bf0bc
Add initial version of const_fn lint 2019-01-29 08:19:05 +01:00
Michael Wright
df04238d3a Fix unit_arg false positive
Ignore arguments with the question mark operator.

Closes #2945
2019-01-29 07:22:08 +02:00
bors
410d5ba6c3 Auto merge of #3700 - phansch:would_you_like_some_help_with_this_const_fn, r=oli-obk
Prevent incorrect cast_lossless suggestion in const_fn

`::from` is not a const fn, so applying the suggestion of
`cast_lossless` would fail to compile. The fix is to skip the lint if
the cast is found inside a const fn.

Fixes #3656
2019-01-28 14:30:18 +00:00
Oliver Scherer
8a417204f8 Remove tests for deprecated items 2019-01-28 10:17:04 +01:00
Oliver Scherer
dc8c7b1677 Atomics constants are now handled by the deprecation lint 2019-01-28 10:10:27 +01:00
Matthias Krüger
16c0a2fa6f update test stderr 2019-01-27 13:46:22 +01:00
Matthias Krüger
e9e0a7e3bd rustup https://github.com/rust-lang/rust/pull/57726 2019-01-27 01:42:34 +01:00
bors
33a0fe7b2c Auto merge of #3690 - mikerite:fix-3630-expect-fun-call, r=phansch
Fix `expect_fun_call` lint suggestions

This commit corrects some bad suggestions produced by the
`expect_fun_call` lint and enables `rust-fix` checking on the tests.

Addresses #3630
2019-01-26 10:57:39 +00:00
Philipp Hansch
8c416c3197
Prevent incorrect cast_lossless suggestion in const_fn
`::from` is not a const fn, so applying the suggestion of
`cast_lossless` would fail to compile. The fix is to skip the lint if
the cast is found inside a const fn.
2019-01-26 10:57:15 +01:00
bors
b1b55e8559 Auto merge of #3701 - mikerite:fix-3118, r=phansch
Fix dogfood tests on Appveyor

This introduces a work-around for a bug in rustup.rs when excuting
cargo from a custom toolchain. Instead of trusting rustup to
invoke cargo from one of the release channels we just invoke
nightly cargo directly.
2019-01-26 09:56:07 +00:00
Michael Wright
94a6eb0695 Fix dogfood tests on Appveyor
This introduces a work-around for a bug in rustup.rs when excuting
cargo from a custom toolchain. Instead of trusting rustup to
invoke cargo from one of the release channels we just invoke
nightly cargo directly.
2019-01-26 11:10:13 +02:00
Sorin Davidoi
dc3bee7962 test(versioncheck): Use .no_deps() 2019-01-25 21:53:44 +01:00
Sorin Davidoi
53ce28a969 test(versioncheck): Fix version equality check 2019-01-25 21:53:44 +01:00
Michael Wright
5284b95a06 Fix expect_fun_call lint suggestions
This commit corrects some bad suggestions produced by the
`expect_fun_call` lint and enables `rust-fix` checking on the tests.

Addresses #3630
2019-01-24 06:58:53 +02:00
A.A.Abroskin
c771f339d7 allow assertions_on_constants for collapsible_if and missing_test_files 2019-01-23 17:58:33 +03:00
A.A.Abroskin
f11d993c0f Merge branch 'master' into add-lints-aseert-checks
* master: (58 commits)
  Rustfmt all the things
  Don't make decisions on values that don't represent the decision
  Improving comments.
  Rustup
  Added rustfix to the test.
  Improve span shortening.
  Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool".
  Actually check for constants.
  Fixed potential mistakes with nesting. Added tests.
  formatting fix
  Update clippy_lints/src/needless_bool.rs
  formatting fix
  Fixing typo in CONTRIBUTING.md
  Fix breakage due to rust-lang/rust#57651
  needless bool lint suggestion is wrapped in brackets if it is an "else" clause of an "if-else" statement
  Fix automatic suggestion on `use_self`.
  Remove negative integer literal checks.
  Fix `implicit_return` false positives.
  Run rustfmt
  Fixed breakage due to rust-lang/rust#57489
  ...
2019-01-23 11:36:12 +03:00
bors
a40d8e4479 Auto merge of #3679 - daxpedda:use_self, r=phansch
Fix automatic suggestion on `use_self`.

In an example like this:
```rust
impl Example {
    fn fun_1() { }
    fn fun_2() {
        Example::fun_1();
    }
}
```
Clippy tries to replace `Example::fun_1` with `Self`, loosing `::fun_1` in the process, it should rather try to replace `Example` with `Self`.

**Question**
- There may be other paths that need the same treatment, but I'm not sure I understand them fully:
  - e648adf086/clippy_lints/src/use_self.rs (L94-L96)
  - e648adf086/clippy_lints/src/use_self.rs (L225-L229)
2019-01-22 19:18:39 +00:00
daxpedda
e6f2239bc3
Added rustfix to the test. 2019-01-22 15:16:54 +01:00
bors
9d5b148648 Auto merge of #3677 - daxpedda:integer_arithmetic, r=oli-obk
Remove negative integer literal checks.

Fixes #3678.
2019-01-21 15:07:22 +00:00
daxpedda
87d24e1fc9
Actually check for constants. 2019-01-21 13:59:49 +01:00
bors
e0bcec717a Auto merge of #3676 - daxpedda:implicit_return, r=oli-obk
Fix `implicit_return` false positives.

Fixes the following false positives:
- linting on `if let` without `else` in a `loop` even with a present `return`
- linting on `unreachable!()`
2019-01-21 12:25:45 +00:00
daxpedda
2e0977f3b4
Fixed potential mistakes with nesting. Added tests. 2019-01-21 13:06:32 +01:00
bors
54978a571c Auto merge of #3680 - g-bartoszek:needless-bool-else-if-brackets, r=oli-obk
needless bool lint suggestion is wrapped in brackets if it is an "els…

…e" clause of an "if-else" statement
2019-01-21 11:47:06 +00:00
Grzegorz Bartoszek
adce3ef966 needless bool lint suggestion is wrapped in brackets if it is an "else" clause of an "if-else" statement 2019-01-20 16:15:00 +01:00
daxpedda
13b5ea4223
Fix automatic suggestion on use_self. 2019-01-20 14:50:26 +01:00
daxpedda
0555ca1c2d
Remove negative integer literal checks. 2019-01-20 14:18:31 +01:00
daxpedda
2183cfcc13
Fix implicit_return false positives. 2019-01-20 13:45:22 +01:00
Michael Wright
f51f0178dd Fixed breakage due to rust-lang/rust#57489 2019-01-20 12:21:30 +02:00
bors
e648adf086 Auto merge of #3674 - sinkuu:fmt_rustup, r=oli-obk
Catch up with `format_args` change

Catches up with a change in rust-lang/rust#57537. (Since the optimization is optional, this clippy PR can be merged before the rustc PR.)

Happened to fix a bug in `expect_fun_call`, that is the lint ignores more than
one arguments to `format`.

```
warning: use of `expect` followed by a function call
 --> src/main.rs:2:17
  |
2 |     Some("foo").expect(format!("{} {}", 1, 2).as_ref());
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{} {}", 1))`
  |
```
2019-01-19 12:40:46 +00:00
Shotaro Yamada
2ee713dc7b Catch up with format_args change
Catches up with a change in rust-lang/rust#57537

Happened to fix a bug in `expect_fun_call`, that is the lint ignores more than
one arguments to `format`.
2019-01-19 21:18:31 +09:00
Michael Wright
a773276da3 Fix bad while_let_on_iterator suggestion.
Don't suggest a `for` loop if the iterator is used inside the `while` loop.

Closes #3670
2019-01-19 11:36:27 +02:00
Unknown
38b3a4ec63 Fixing issues pointed out by dogfood tests. 2019-01-18 00:12:35 -05:00
Unknown
a3b3a54e93 Update to collect all the files then throw the error. 2019-01-17 23:50:30 -05:00
Unknown
8b81208012 Adding a test for checking if test files are missing. 2019-01-17 23:19:51 -05:00
Michael Wright
89de4c9766 Really fix issue number in map_clone test 2019-01-15 08:36:56 +02:00