Commit Graph

7866 Commits

Author SHA1 Message Date
Lzu Tao
46df9716af Prevent failing to restart setup-toolchain
If `rustup-toolchain-install-master` fails to install master
toolchain (in case `rustup update` executes at the same remove the
tmp directory), `cargo search` (which use master toolchain after
`rustup override` command) will fail. This leads to setup-toolchain
fails too.
2020-02-05 20:37:33 +07:00
bors
c881aca282 Auto merge of #5135 - lzutao:config, r=flip1995
Few improvement to `utils::conf` module

* Fix a few typos
* Handle Option<&Path> early
* Use `env::var_os` when possible

changelog: none
2020-02-05 09:58:15 +00:00
Lzu Tao
32924c6ce0 Few improvement to utils::conf module
* Fix a few typos
* Handle Option<&Path> early
* Use `env::var_os` when possible
2020-02-05 09:06:34 +07:00
bors
298df70368 Auto merge of #5061 - ThibsG:UselessMatch3664, r=flip1995
Add new lint: match with a single binding statement

This lint catches `match` statements that binds to only one block and could be rewritten using a simple `let` statement.

Lint name: MATCH_SINGLE_BINDING

fixes: #3664

changelog: add lint for match with single binding statement
2020-02-04 22:16:13 +00:00
ThibsG
00904cb100 Manage macros case + move to MaybeIncorrect when binding values 2020-02-04 22:54:42 +01:00
ThibsG
53094de08e Merge fixes 2020-02-04 22:53:24 +01:00
ThibsG
b29aacfec8 Add wild and struct handling 2020-02-04 22:53:24 +01:00
ThibsG
6afd7ea147 Use span_lint_and_sugg + move infaillible lint
- moving infaillible lint to prevent collisions
2020-02-04 22:49:08 +01:00
Yuki Okushi
19ce66c1c1 Re-cover use of unnecessary unwraps in macros 2020-02-05 05:38:26 +09:00
bors
d33c603d26 Auto merge of #5124 - flip1995:backport_back_merge, r=flip1995
Merge backport branch back into master

Merge back backport branch rust-1.42.0 into master.

Waiting on rust-lang/rust#68753

changelog: none
2020-02-04 13:22:19 +00:00
ThibsG
3445d41f07 Add new lint: match with a single binding statement
- Lint name: MATCH_SINGLE_BINDING
2020-02-04 01:06:16 +01:00
Yuki Okushi
514b1bc2af Do not lint unnecessary_unwrap in macros 2020-02-04 04:01:42 +09:00
bors
536c255b43 Auto merge of #5130 - JohnTitor:split-up-index-slice, r=flip1995
Split up `indexing_slicing` ui test

Closes #2038

Now all the stderrs are less than 200 lines 🎉

changelog: none
2020-02-03 17:22:10 +00:00
bors
a39589480b Auto merge of #5129 - JohnTitor:use-checked-sub, r=flip1995
Use `checked_sub` to avoid index out of bounds

(Fixes) #4681 (possibly)

The issue likely occurs due to `lit_snip.len() < suffix.len() + 1`. You can see similar backtrace to change it to `lit_snip.len() - suffix.len() - 1000` or something then run `cargo test --release`.
But I couldn't come up with the test so I'd leave the issue open if we want.

changelog: Fix potential ICE in `misc_early`
2020-02-03 16:47:25 +00:00
Yuki Okushi
49934e70a2 Remove unnecessary comment 2020-02-04 01:29:11 +09:00
bors
fdc6690a2e Auto merge of #5127 - Areredify:issue-5115, r=flip1995
improve 'iter_nth_zero' documentation

closes #5115

changelog: Improve the documentation of `iter_nth_zero`
2020-02-03 16:16:44 +00:00
Areredify
66ad544175 improve 'iter_nth_zero' documentation 2020-02-03 15:44:55 +03:00
Yuki Okushi
bae129ac69 Use checked_sub to avoid index out of bounds 2020-02-03 15:19:54 +09:00
Yuki Okushi
7a36a8d98a Decrease line length limit for stderrs 2020-02-03 15:11:02 +09:00
Yuki Okushi
7c5785ca2b Split up indexing_slicing ui test 2020-02-03 15:09:17 +09:00
bors
6184710d08 Auto merge of #5120 - JohnTitor:split-up-drop-forget-ref, r=flip1995
Split up `drop_forget_ref` ui test

Part of #2038

changelog: none
2020-02-02 18:16:33 +00:00
bors
c6b87ef54a Auto merge of #5119 - JohnTitor:tweak-doc, r=flip1995
Tweak documentation in `multiple_crate_versions`

This example isn't reproducible now since `ctrlc` upgrades `winapi` to `0.3.x` in `3.1.1`. We should pin their versions to trigger lint correctly.

changelog: none
2020-02-02 17:48:12 +00:00
flip1995
096b2b8870
Merge remote-tracking branch 'upstream/rust-1.42.0' into backport_back_merge 2020-02-02 00:40:56 +01:00
bors
ea85b4c7fb Auto merge of #5123 - JohnTitor:rustup-0202, r=matthiaskrgr
Rustup to rust-lang/rust#68133

changelog: none
2020-02-01 22:40:18 +00:00
Yuki Okushi
f63a6a5baf Rustup to rust-lang/rust#68133 2020-02-02 06:56:27 +09:00
flip1995
4ee120633c
Move debug_assertions_with_mut_call to nursery 2020-02-01 16:42:03 +01:00
flip1995
9c223d9321
Add test for await in debug_assert!(..) 2020-02-01 16:41:41 +01:00
flip1995
f16e383709
Don't trigger debug_assert_with_mut_call on .await 2020-02-01 16:41:31 +01:00
flip1995
2c4df2418c
Small refactor of mutable_debug_assertions 2020-02-01 16:41:19 +01:00
Yuki Okushi
fa32b41365 Split up drop_forget_ref ui test 2020-02-01 20:28:27 +09:00
Yuki Okushi
0f67a7ecb5 Pin versions to trigger lint correctly 2020-02-01 20:11:32 +09:00
bors
f3e2ccd54e Auto merge of #5116 - matthiaskrgr:rustup_29, r=flip1995
update test stderr

changelog: none
2020-01-31 20:35:22 +00:00
Matthias Krüger
187983e991 update test stderr 2020-01-31 20:21:10 +01:00
bors
5826a0472d Auto merge of #5106 - flip1995:dbg_assert_mut_async, r=oli-obk
Don't trigger [debug_assert_with_mut_call] on debug_assert!(_.await)

Fixes #5105

cc #5112

changelog: Don't trigger [`debug_assert_with_mut_call`] on `debug_assert!(_.await)` and move it to nursery.
2020-01-31 17:05:35 +00:00
flip1995
5ba4aa8eba
Move debug_assertions_with_mut_call to nursery 2020-01-31 10:57:52 +01:00
flip1995
006f07f090
Add test for await in debug_assert!(..) 2020-01-31 10:57:51 +01:00
flip1995
9fbd7f478e
Don't trigger debug_assert_with_mut_call on .await 2020-01-31 10:39:05 +01:00
flip1995
b31a3dff48
Small refactor of mutable_debug_assertions 2020-01-31 10:39:04 +01:00
bors
b90101251f Auto merge of #5111 - flip1995:changelog, r=phansch
Update changelog

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

r? @phansch

changelog: none
2020-01-31 07:53:37 +00:00
bors
ca2abaf366 Auto merge of #5109 - phansch:ciao_util_dev, r=flip1995
Deprecate util/dev in favor of cargo alias

This means one less shell script and a bit more cross-platform support
for contributors.

If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config` where an alias for calling the `clippy_dev` binary is defined.

changelog: none
2020-01-31 07:18:06 +00:00
Phil Hansch
8f457fa4c9
Mark clippy_project_root as must_use
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-01-31 07:32:53 +01:00
Philipp Hansch
3f2532b904
Replace one more copy-pasted clippy_project_root fn 2020-01-31 07:30:44 +01:00
bors
8e9089e454 Auto merge of #5110 - Aloso:patch-1, r=flip1995
Fix syntax highlighting of code fences

The documentation for RESULT_EXPECT_USED includes this code:

    let res: Result<usize, ()> = Ok(1);
    res?;
    # Ok::<(), ()>(())

Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.

EDIT: I noticed that highlighting for some other lints is broken as well. It only works if the code fence looks like this:

````markdown
```rust
// ..
```
````

However, many code blocks were ignored. I un-ignored most code blocks and made them compile by adding hidden code with `#`. While doing so, I found two mistakes:

```rust
opt.map_or(None, |a| a + 1)
// instead of
opt.map_or(None, |a| Some(a + 1))
```
and

```rust
fn as_str(self) -> &str
// instead of
fn as_str(self) -> &'static str
```

changelog: none
2020-01-30 23:24:53 +00:00
Ludwig Stecher
1f600f3f9a Un-ignore most code blocks to render correctly on website, correct mistakes 2020-01-30 23:44:37 +01:00
flip1995
1ef4509eb4
Update changelog 2020-01-30 23:34:07 +01:00
Ludwig Stecher
58da5ba6db Fix code formatting for more lints 2020-01-30 22:12:00 +01:00
bors
bbef531518 Auto merge of #5108 - JohnTitor:split-up-0130, r=flip1995
Split up `match` ui test

Part of #2038

Also, this decreases the line length limit to 220.

changelog: none
2020-01-30 21:06:47 +00:00
Ludwig Stecher
f0dc98160b
Fix syntax highlighting of code fence
The documentation for RESULT_EXPECT_USED includes this code:

    let res: Result<usize, ()> = Ok(1);
    res?;
    # Ok::<(), ()>(())

Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.
2020-01-30 21:55:30 +01:00
Philipp Hansch
3036a2c30e
Move project_root function to clippy_dev/src/lib.rs
This allows us to use the method in both `fmt.rs` and `lib.rs` in
multiple places. The downside is that we panic inside the method now,
instead of using the error handling in `fmt.rs`. We may want to
centralize the error handling for clippy_dev at some point, though.
2020-01-30 21:34:25 +01:00
Philipp Hansch
4d1a11d354
Deprecate util/dev in favor of cargo alias
If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config`.

This means one less shell script and a bit more cross-platform support
for contributors.
2020-01-30 21:34:31 +01:00