Commit Graph

5462 Commits

Author SHA1 Message Date
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
bors
280069ddc7 Auto merge of #3685 - rust-lang:rustup, r=flip1995
Rustup
2019-01-22 16:07:32 +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
daxpedda
e6f2239bc3
Added rustfix to the test. 2019-01-22 15:16:54 +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
bors
1838bfe5a9 Auto merge of #3681 - rmcteggart-r7:master, r=matthiaskrgr
Fixing typo in CONTRIBUTING.md

Noticed small typo in CONTRIBUTING readme when working on another issue
2019-01-20 22:21:00 +00:00
bors
5b64f6875e Auto merge of #3675 - mikerite:fix-build-20190120, r=matthiaskrgr
Fix build 20190120
2019-01-20 21:52:18 +00:00
rmcteggart-r7
d17c3d99d0 Fixing typo in CONTRIBUTING.md 2019-01-20 21:25:36 +00: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
Michael Wright
77b71a1af2 Fix breakage due to rust-lang/rust#57755 2019-01-20 10:14:23 +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
bors
751d82e825 Auto merge of #3672 - mikerite:fix-3670, r=oli-obk
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:12:03 +00:00
bors
e99a4d8d9e Auto merge of #3671 - matthiaskrgr:rustup, r=oli-obk
rustup https://github.com/rust-lang/rust/pull/57747
2019-01-19 10:46:32 +00: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
Matthias Krüger
de9c09e2bd rustup https://github.com/rust-lang/rust/pull/57747 2019-01-19 09:27:45 +01:00
bors
235f96005c Auto merge of #3669 - avborhanian:extra_results_files, r=oli-obk
Check for results files missing tests

Addresses #3572.

Basically iterates over all the files, and if it sees any files that don't have a matching rs file, it throws an error.
2019-01-18 08:27:06 +00:00
bors
f48e605ec4 Auto merge of #3668 - phansch:remove_bors_toml, r=flip1995
Remove bors.toml

This file was only needed for bors-ng, but now we use the default
rust-lang bors fork.
2019-01-18 07:44:17 +00: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
Philipp Hansch
e08c0954cc
Remove bors.toml
This file was only needed for bors-ng, but now we use the default
rust-lang bors fork.
2019-01-17 18:50:24 +01:00
bors
59b250e4f9 Auto merge of #3667 - euclio:applicability, r=phansch
add applicability to lint name suggestion
2019-01-17 16:26:50 +00:00
Andy Russell
8fba46aa27
add applicability to lint name suggestion 2019-01-16 15:29:37 -05:00
bors
1b89724b48 Auto merge of #3662 - mikerite:fix-498, r=oli-obk
Fix `map_clone` bad suggestion

`cloned` requires that the elements of the iterator must be references. This
change determines if that is the case by examining the type of the closure
argument and suggesting `.cloned` only if it is a reference. When the closure
argument is not a reference, it suggests removing the `map` call instead.

A minor problem with this change is that the new check sometimes overlaps
with the `clone_on_copy` lint.

Fixes #498
2019-01-15 09:04:09 +00:00
Michael Wright
89de4c9766 Really fix issue number in map_clone test 2019-01-15 08:36:56 +02:00
Michael Wright
f53f12b0c3 Fix issue number in map_clone test 2019-01-15 08:17:55 +02:00
Michael Wright
f96dc2e9e2 Remove map_clone fixed known problem 2019-01-15 08:15:12 +02:00
Michael Wright
67a9f20c91 Fix map_clone bad suggestion
`cloned` requires that the elements of the iterator must be references. This
change determines if that is the case by examining the type of the closure
argument and suggesting `.cloned` only if it is a reference. When the closure
argument is not a reference, it suggests removing the `map` call instead.

A minor problem with this change is that the new check sometimes overlaps
with the `clone_on_copy` lint.

Fixes #498
2019-01-15 08:09:47 +02:00
bors
19553aee2c Auto merge of #3657 - roblabla:bugfix-missing-docs-global-asm, r=phansch
Missing docs: don't require documenting Global Asm items.

global_asm! items cannot be documented, the lint still gets triggered after adding documentation to the macro invocation. Furthermore, even if we could add documentation to the AST node, rustdoc doesn't render it anyways.

Playground example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=5182df182f0ffbbab4c3107e43368ac3
2019-01-14 14:50:27 +00:00
bors
11ba624e38 Auto merge of #3653 - gendx:master, r=phansch
Fix typos in clippy_lints/src/len_zero.rs

Some comments in the len_zero lint had typos.
2019-01-14 09:16:20 +00:00