]>
git.lizzy.rs Git - rust.git/log
Lzu Tao [Thu, 6 Feb 2020 14:28:50 +0000 (21:28 +0700)]
dev: Make UpdateMode a copy type
Lzu Tao [Thu, 6 Feb 2020 14:13:39 +0000 (21:13 +0700)]
dev: Prefer `fs::read*` and improvement to replace text region
bors [Thu, 6 Feb 2020 21:41:50 +0000 (21:41 +0000)]
Auto merge of #5134 - flip1995:snippet_block, r=phansch
Make it possible to correctly indent snippet_block snippets
This adds a `indent_relative_to` arg to the `{snippet,expr}_block` functions. This makes it possible to keep the correct indentation of block like suggestions.
In addition, this makes the `trim_multiline` function private and adds a `indent_of` function, to get the indentation of the first line of a span.
The suggestion of `needless_continue` cannot be made auto applicable, since it would be also necessary to remove code following the linted expression. (Well, maybe it is possible, but I don't know how to do it. Expanding the suggestion span to the last expression, that should be removed didn't work)
changelog: Improve suggestions, when blocks of code are involved
bors [Thu, 6 Feb 2020 20:53:17 +0000 (20:53 +0000)]
Auto merge of #5143 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#68788
cc rust-lang/rust#68901
changelog: none
flip1995 [Thu, 6 Feb 2020 19:29:58 +0000 (20:29 +0100)]
Rustup to rust-lang/rust#68788
flip1995 [Wed, 5 Feb 2020 10:09:48 +0000 (11:09 +0100)]
Rename ctx->cx in needless_continue
flip1995 [Wed, 5 Feb 2020 09:42:33 +0000 (10:42 +0100)]
Improve help message in needless_continue
flip1995 [Wed, 5 Feb 2020 08:55:48 +0000 (09:55 +0100)]
Fix rebase fallout
flip1995 [Tue, 4 Feb 2020 16:02:46 +0000 (17:02 +0100)]
Document the indent_relative_to arg of snippet_block
flip1995 [Tue, 4 Feb 2020 15:13:06 +0000 (16:13 +0100)]
Update remaining test files
flip1995 [Tue, 4 Feb 2020 15:12:51 +0000 (16:12 +0100)]
Move tests to the end of the file in utils mod.rs
flip1995 [Tue, 4 Feb 2020 15:11:49 +0000 (16:11 +0100)]
Update needless_continue stderr
flip1995 [Tue, 4 Feb 2020 15:10:59 +0000 (16:10 +0100)]
Rewrite suggestion generation of needless_continue
flip1995 [Tue, 4 Feb 2020 15:08:39 +0000 (16:08 +0100)]
Update block_in_if_condition test files
flip1995 [Tue, 4 Feb 2020 15:08:15 +0000 (16:08 +0100)]
Make block_in_if_condition auto applicable
flip1995 [Tue, 4 Feb 2020 15:07:09 +0000 (16:07 +0100)]
Optionally indent snippet_block relative to an Expr
bors [Thu, 6 Feb 2020 15:31:01 +0000 (15:31 +0000)]
Auto merge of #5139 - lzutao:linecount, r=llogiq
dev: Use bytecount for faster line count
changelog: none
bors [Thu, 6 Feb 2020 14:47:14 +0000 (14:47 +0000)]
Auto merge of #5125 - Areredify:too_many_bools, r=flip1995
Port mitsuhiko's excessive bools lints
Closes #4 .
changelog: add `struct_excessive_bools` and `fn_params_excessive_bools` lints.
I moved is_trait_impl_item check because at first I implemented it as a late pass for some reason but then I realized it's actually an early lint. But it's a useful function to have, should I move it into a separate pr?
Lzu Tao [Thu, 6 Feb 2020 14:39:15 +0000 (21:39 +0700)]
dev: Use bytecount for faster line count
bors [Thu, 6 Feb 2020 14:17:35 +0000 (14:17 +0000)]
Auto merge of #5132 - JohnTitor:fix-fp-in-unwrap-lint, r=flip1995
Do not lint `unnecessary_unwrap` in external macros
Fixes #5131
I think we shouldn't lint `{panicking, unnecessary}_unwrap` in macros, not just `assert!`.
changelog: Fix false positive in `unnecessary_unwrap`
bors [Thu, 6 Feb 2020 09:19:29 +0000 (09:19 +0000)]
Auto merge of #5121 - lzutao:comptest, r=flip1995
Improve compile_test and dogfood tests
* Hopefully this finally resolves the "multiple matching crates" error, e.g. #4015
* This handle some convenient CARGO env like CARGO_TARGET_DIR and CARGO_BUILD_TARGET
changelog: none
Areredify [Sat, 1 Feb 2020 23:49:52 +0000 (02:49 +0300)]
add excessive bools lints
Lzu Tao [Wed, 5 Feb 2020 15:13:55 +0000 (16:13 +0100)]
Use lazy_static
Areredify [Thu, 30 Jan 2020 23:39:10 +0000 (02:39 +0300)]
move is_trait_impl_item check from functions.rs to utils
Lzu Tao [Wed, 5 Feb 2020 15:00:19 +0000 (22:00 +0700)]
Add `serde_derive` to the need-to-be-disambiguated-crates list
Lzu Tao [Sat, 1 Feb 2020 17:00:48 +0000 (00:00 +0700)]
Fix dogfood to use cargo mod too
Lzu Tao [Sat, 1 Feb 2020 10:04:04 +0000 (11:04 +0100)]
compile-test: Handle CARGO_TARGET_DIR and transitive deps
bors [Wed, 5 Feb 2020 14:16:17 +0000 (14:16 +0000)]
Auto merge of #5137 - lzutao:race, r=flip1995
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.
changelog: none
Lzu Tao [Wed, 5 Feb 2020 13:37:33 +0000 (20:37 +0700)]
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.
bors [Wed, 5 Feb 2020 09:58:15 +0000 (09:58 +0000)]
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
Lzu Tao [Wed, 5 Feb 2020 02:06:34 +0000 (09:06 +0700)]
Few improvement to `utils::conf` module
* Fix a few typos
* Handle Option<&Path> early
* Use `env::var_os` when possible
bors [Tue, 4 Feb 2020 22:16:13 +0000 (22:16 +0000)]
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
ThibsG [Tue, 4 Feb 2020 19:19:20 +0000 (20:19 +0100)]
Manage macros case + move to MaybeIncorrect when binding values
ThibsG [Tue, 4 Feb 2020 07:20:49 +0000 (08:20 +0100)]
Merge fixes
ThibsG [Sun, 26 Jan 2020 16:03:39 +0000 (17:03 +0100)]
Add wild and struct handling
ThibsG [Sun, 19 Jan 2020 10:07:13 +0000 (11:07 +0100)]
Use span_lint_and_sugg + move infaillible lint
- moving infaillible lint to prevent collisions
Yuki Okushi [Tue, 4 Feb 2020 20:38:26 +0000 (05:38 +0900)]
Re-cover use of unnecessary unwraps in macros
bors [Tue, 4 Feb 2020 13:22:19 +0000 (13:22 +0000)]
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
ThibsG [Wed, 15 Jan 2020 06:56:56 +0000 (07:56 +0100)]
Add new lint: match with a single binding statement
- Lint name: MATCH_SINGLE_BINDING
Yuki Okushi [Mon, 3 Feb 2020 19:01:42 +0000 (04:01 +0900)]
Do not lint `unnecessary_unwrap` in macros
bors [Mon, 3 Feb 2020 17:22:10 +0000 (17:22 +0000)]
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 :tada:
changelog: none
bors [Mon, 3 Feb 2020 16:47:25 +0000 (16:47 +0000)]
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`
Yuki Okushi [Mon, 3 Feb 2020 16:29:11 +0000 (01:29 +0900)]
Remove unnecessary comment
bors [Mon, 3 Feb 2020 16:16:44 +0000 (16:16 +0000)]
Auto merge of #5127 - Areredify:issue-5115, r=flip1995
improve 'iter_nth_zero' documentation
closes #5115
changelog: Improve the documentation of `iter_nth_zero`
Areredify [Sun, 2 Feb 2020 22:19:16 +0000 (01:19 +0300)]
improve 'iter_nth_zero' documentation
Yuki Okushi [Mon, 3 Feb 2020 01:42:21 +0000 (10:42 +0900)]
Use `checked_sub` to avoid index out of bounds
Yuki Okushi [Mon, 3 Feb 2020 06:11:02 +0000 (15:11 +0900)]
Decrease line length limit for stderrs
Yuki Okushi [Mon, 3 Feb 2020 06:09:17 +0000 (15:09 +0900)]
Split up `indexing_slicing` ui test
bors [Sun, 2 Feb 2020 18:16:33 +0000 (18:16 +0000)]
Auto merge of #5120 - JohnTitor:split-up-drop-forget-ref, r=flip1995
Split up `drop_forget_ref` ui test
Part of #2038
changelog: none
bors [Sun, 2 Feb 2020 17:48:12 +0000 (17:48 +0000)]
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
flip1995 [Sat, 1 Feb 2020 23:40:56 +0000 (00:40 +0100)]
Merge remote-tracking branch 'upstream/rust-1.42.0' into backport_back_merge
bors [Sat, 1 Feb 2020 22:40:18 +0000 (22:40 +0000)]
Auto merge of #5123 - JohnTitor:rustup-0202, r=matthiaskrgr
Rustup to rust-lang/rust#68133
changelog: none
Yuki Okushi [Sat, 1 Feb 2020 21:56:27 +0000 (06:56 +0900)]
Rustup to rust-lang/rust#68133
flip1995 [Fri, 31 Jan 2020 09:42:31 +0000 (10:42 +0100)]
Move debug_assertions_with_mut_call to nursery
flip1995 [Wed, 29 Jan 2020 14:47:22 +0000 (15:47 +0100)]
Add test for `await` in `debug_assert!(..)`
flip1995 [Wed, 29 Jan 2020 14:46:38 +0000 (15:46 +0100)]
Don't trigger `debug_assert_with_mut_call` on `.await`
flip1995 [Wed, 29 Jan 2020 14:45:42 +0000 (15:45 +0100)]
Small refactor of mutable_debug_assertions
Yuki Okushi [Sat, 1 Feb 2020 11:28:27 +0000 (20:28 +0900)]
Split up `drop_forget_ref` ui test
Yuki Okushi [Sat, 1 Feb 2020 11:11:32 +0000 (20:11 +0900)]
Pin versions to trigger lint correctly
bors [Fri, 31 Jan 2020 20:35:22 +0000 (20:35 +0000)]
Auto merge of #5116 - matthiaskrgr:rustup_29, r=flip1995
update test stderr
changelog: none
Matthias Krüger [Fri, 31 Jan 2020 19:21:10 +0000 (20:21 +0100)]
update test stderr
bors [Fri, 31 Jan 2020 17:05:35 +0000 (17:05 +0000)]
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.
flip1995 [Fri, 31 Jan 2020 09:42:31 +0000 (10:42 +0100)]
Move debug_assertions_with_mut_call to nursery
flip1995 [Wed, 29 Jan 2020 14:47:22 +0000 (15:47 +0100)]
Add test for `await` in `debug_assert!(..)`
flip1995 [Wed, 29 Jan 2020 14:46:38 +0000 (15:46 +0100)]
Don't trigger `debug_assert_with_mut_call` on `.await`
flip1995 [Wed, 29 Jan 2020 14:45:42 +0000 (15:45 +0100)]
Small refactor of mutable_debug_assertions
bors [Fri, 31 Jan 2020 07:53:37 +0000 (07:53 +0000)]
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
bors [Fri, 31 Jan 2020 07:18:06 +0000 (07:18 +0000)]
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
Phil Hansch [Fri, 31 Jan 2020 06:32:53 +0000 (07:32 +0100)]
Mark clippy_project_root as `must_use`
Co-Authored-By: Philipp Krones <hello@philkrones.com>
Philipp Hansch [Fri, 31 Jan 2020 06:30:44 +0000 (07:30 +0100)]
Replace one more copy-pasted clippy_project_root fn
bors [Thu, 30 Jan 2020 23:24:53 +0000 (23:24 +0000)]
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
Ludwig Stecher [Thu, 30 Jan 2020 22:44:37 +0000 (23:44 +0100)]
Un-ignore most code blocks to render correctly on website, correct mistakes
flip1995 [Thu, 30 Jan 2020 22:26:25 +0000 (23:26 +0100)]
Update changelog
Ludwig Stecher [Thu, 30 Jan 2020 21:12:00 +0000 (22:12 +0100)]
Fix code formatting for more lints
bors [Thu, 30 Jan 2020 21:06:47 +0000 (21:06 +0000)]
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
Ludwig Stecher [Thu, 30 Jan 2020 20:55:30 +0000 (21:55 +0100)]
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.
Philipp Hansch [Thu, 30 Jan 2020 20:29:21 +0000 (21:29 +0100)]
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.
Philipp Hansch [Thu, 30 Jan 2020 07:33:48 +0000 (08:33 +0100)]
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.
bors [Thu, 30 Jan 2020 20:24:24 +0000 (20:24 +0000)]
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
bors [Thu, 30 Jan 2020 19:49:05 +0000 (19:49 +0000)]
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
Areredify [Thu, 30 Jan 2020 15:10:19 +0000 (18:10 +0300)]
lint all guard types, not just lock functions
Mikhail Babenko [Tue, 28 Jan 2020 09:28:11 +0000 (12:28 +0300)]
decouple 'let_underscore' tests
Mikhail Babenko [Mon, 27 Jan 2020 14:34:30 +0000 (17:34 +0300)]
add lint
Yuki Okushi [Thu, 30 Jan 2020 03:08:38 +0000 (12:08 +0900)]
Decrease line length limit for stderr files
Yuki Okushi [Thu, 30 Jan 2020 03:06:42 +0000 (12:06 +0900)]
Split up `match` ui test
Yuki Okushi [Thu, 30 Jan 2020 02:43:19 +0000 (11:43 +0900)]
Revive test in `enum_clike_unportable_variant`
bors [Wed, 29 Jan 2020 16:29:05 +0000 (16:29 +0000)]
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;`).
xiongmao86 [Wed, 29 Jan 2020 16:23:47 +0000 (00:23 +0800)]
Reformat code.
xiongmao86 [Wed, 29 Jan 2020 16:22:42 +0000 (00:22 +0800)]
Add test and update reference.
xiongmao86 [Wed, 29 Jan 2020 16:21:29 +0000 (00:21 +0800)]
Declare lint and implement lint logic.
bors [Wed, 29 Jan 2020 08:31:51 +0000 (08:31 +0000)]
Auto merge of #5104 - JohnTitor:rustup-0129, r=Manishearth
Rustup to rust-lang/rust#68512
changelog: none
Yuki Okushi [Wed, 29 Jan 2020 08:15:56 +0000 (17:15 +0900)]
Rustup to rust-lang/rust#68512
bors [Mon, 27 Jan 2020 11:09:45 +0000 (11:09 +0000)]
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
bors [Mon, 27 Jan 2020 10:37:17 +0000 (10:37 +0000)]
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
Yuki Okushi [Mon, 27 Jan 2020 03:14:11 +0000 (12:14 +0900)]
Split up `non_copy_const` ui test
Yuki Okushi [Mon, 27 Jan 2020 02:26:42 +0000 (11:26 +0900)]
Rename `span_note_and_lint` to `span_lint_and_note`
Yuki Okushi [Mon, 27 Jan 2020 01:56:22 +0000 (10:56 +0900)]
Rename `span_help_and_lint` to `span_lint_and_help`
bors [Sun, 26 Jan 2020 15:28:39 +0000 (15:28 +0000)]
Auto merge of #5084 - JohnTitor:clean-up-span-lint, r=flip1995
Clean up `span_lint` in `methods/mod.rs`
Uses `span_help_and_lint` instead of `span_lint` and `span_lint_and_sugg` instead of `span_lint_and_then`.
changelog: none
bors [Sun, 26 Jan 2020 10:50:47 +0000 (10:50 +0000)]
Auto merge of #5097 - phansch:remove_fixme, r=llogiq
Resolve FIXME: String::new is now a const fn
`const_string_new` is stable since Rust 1.39
changelog: none
Philipp Hansch [Sun, 26 Jan 2020 10:03:53 +0000 (11:03 +0100)]
Resolve FIXME: String::new is now a const fn
`const_string_new` is stable since Rust 1.39