Commit graph

2267 commits

Author SHA1 Message Date
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
68cc4df551
Maybe fix ICE? 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
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
60332941c9 Rustfmt 2019-01-28 11:32:41 +01:00
Oliver Scherer
c67a05166f Check hypothetically failing conversion 2019-01-28 10:32:34 +01:00
Oliver Scherer
7b90cb529a Update more changed iterator paths 2019-01-28 10:16:34 +01:00
Oliver Scherer
dc8c7b1677 Atomics constants are now handled by the deprecation lint 2019-01-28 10:10:27 +01:00
Oliver Scherer
36245feeb0 Update changed iterator paths 2019-01-28 10:09:45 +01:00
Oliver Scherer
b08964b3bd Update const slice processing 2019-01-28 10:09:34 +01:00
bors
62f40e28b9 Auto merge of #3706 - robamler:patch-1, r=phansch
Fix documentation for `slow_vector_initialization`

This PR fixes the documentation for the lint `slow_vector_initialization`. The documentation recommended writing `vec![len; 0]` but the correct solution is `vec![0; len]`.
2019-01-27 13:34:47 +00:00
Matthias Krüger
79b1d9adf0 run cargo fmt 2019-01-27 13:34:23 +01:00
Matthias Krüger
3a96d6b603 rustup https://github.com/rust-lang/rust/pull/57907/
for file in `fd \.rs$` ; do sed  -i  s/span_suggestion_with_applicability/span_suggestion/g $file ; done

for file in `fd \.rs$` ; do sed  -i  s/span_suggestion_short_with_applicability/span_suggestion_short/g $file ; done

for file in `fd \.rs$` ; do sed  -i  s/span_suggestions_with_applicability/span_suggestions/g $file ; done
2019-01-27 13:33:56 +01:00
Robert Bamler
14e27f567a
Fix documentation for slow_vector_initialization
Change the recommended solution from `vec![len; 0]` to `vec![0; len]`.

Also fix grammar.
2019-01-26 20:26:38 -08: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
Michael Wright
18cacbabb4 Incorporate review suggestions 2019-01-26 11:55:54 +02:00
Sorin Davidoi
1fe0cf6f07 chore(cargo/dependencies/cargo-metadata): Upgrade to 0.7.1
Closes https://github.com/rust-lang/rust-clippy/issues/3692.
2019-01-25 21:53:44 +01:00
Matthias Krüger
873fe11ca5 dependencies: update itertools from 0.7 to 0.8 2019-01-25 20:25:14 +01:00
Philipp Hansch
0bac0149e7
Rustup
Due to https://github.com/rust-lang/rust/pull/51285
2019-01-24 20:32:18 +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
a069320fd7 Auto merge of #3684 - g-bartoszek:sugg-snippet-modifications, r=phansch
"make_return" and "blockify" convenience methods, fixes #3683

…ed them in "needless_bool".
2019-01-22 20:18:11 +00: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
Oliver Scherer
d6c806378e Rustfmt all the things 2019-01-22 16:27:42 +01:00
Oliver Scherer
38cdf63acf Don't make decisions on values that don't represent the decision 2019-01-22 15:28:51 +01:00
daxpedda
42d5a07f0c
Improving comments. 2019-01-22 15:23:45 +01:00
Oliver Scherer
3168023cc8 Rustup 2019-01-22 15:17:05 +01:00
Philipp Krones
e70f9456fc
Improve span shortening.
Co-Authored-By: daxpedda <1645124+daxpedda@users.noreply.github.com>
2019-01-22 14:43:59 +01:00
Grzegorz Bartoszek
0f5c43a722 Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool". 2019-01-22 14:07:53 +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
34785a12f4 formatting fix 2019-01-21 12:04:25 +01:00
Oliver Scherer
4532073a29
Update clippy_lints/src/needless_bool.rs
Co-Authored-By: g-bartoszek <grzegorz.bartoszek@thaumatec.com>
2019-01-21 11:41:33 +01:00
Grzegorz Bartoszek
0a0792e535 formatting fix 2019-01-21 11:14:34 +01:00
Michael Wright
a747dbb04f Fix breakage due to rust-lang/rust#57651 2019-01-20 22:56:07 +02: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
8747691bea Run rustfmt 2019-01-20 12:49:45 +02:00
Michael Wright
f51f0178dd Fixed breakage due to rust-lang/rust#57489 2019-01-20 12:21:30 +02:00