Commit Graph

7800 Commits

Author SHA1 Message Date
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
bors
668bc485da Auto merge of #5101 - Areredify:let_underscore_lock, r=flip1995
add `let_underscore_lock` lint

closes #1574
changelog: add `let_underscore_lock` lint

I am not entirely sure about my docs/messages wording here, improvements are welcome
2020-01-30 20:24:24 +00:00
bors
8002bad114 Auto merge of #5107 - JohnTitor:revive-test, r=flip1995
Revive test in `enum_clike_unportable_variant`

Revive one test since mentioned ICE has been resolved.

changelog: none
2020-01-30 19:49:05 +00:00
Areredify
63ab7a5e8c lint all guard types, not just lock functions 2020-01-30 18:46:22 +03:00
Mikhail Babenko
9b88a2b295 decouple 'let_underscore' tests 2020-01-30 16:51:23 +03:00
Mikhail Babenko
d1f8621711 add lint 2020-01-30 16:48:56 +03:00
Yuki Okushi
411317bd2c Decrease line length limit for stderr files 2020-01-30 12:08:38 +09:00
Yuki Okushi
17489ef811 Split up match ui test 2020-01-30 12:06:42 +09:00
Yuki Okushi
ed6a0cc8a1 Revive test in enum_clike_unportable_variant 2020-01-30 11:43:19 +09:00
bors
f69835bab7 Auto merge of #5058 - xiongmao86:issue4903, r=flip1995
Closes Issue4903

fixes #4903.

Check list:
- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [x] Added lint documentation
- [x] Run `./util/dev fmt`

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

changelog: implement lint that warn about single component path imports(`use ident;`).
2020-01-29 16:29:05 +00:00
xiongmao86
ac9f019fbf Reformat code. 2020-01-30 00:23:47 +08:00
xiongmao86
26b1d60f15 Add test and update reference. 2020-01-30 00:22:42 +08:00
xiongmao86
512efbea23 Declare lint and implement lint logic. 2020-01-30 00:21:29 +08:00
bors
c0f39cfb46 Auto merge of #5104 - JohnTitor:rustup-0129, r=Manishearth
Rustup to rust-lang/rust#68512

changelog: none
2020-01-29 08:31:51 +00:00
Yuki Okushi
66524c5be0 Rustup to rust-lang/rust#68512 2020-01-29 17:15:56 +09:00
bors
5b42a76792 Auto merge of #5099 - JohnTitor:split-up-non-copy-const, r=flip1995
Split up `non_copy_const` ui test

Part of #2038
Maybe there is a better way to avoid duplications of constants.

changelog: none
2020-01-27 11:09:45 +00:00
bors
5e722ba670 Auto merge of #5098 - JohnTitor:rename-span-lints, r=flip1995
Rename `span_{help, note}_and_lint` to `span_lint_and_*`

`span_*_and_lint` and `span_lint_and_*` make us confused. The order should be the same.

[context](https://github.com/rust-lang/rust-clippy/pull/5084#issuecomment-578411309)

changelog: none
2020-01-27 10:37:17 +00:00