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?
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
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.
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 [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.
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
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.
bors [Sun, 26 Jan 2020 07:42:55 +0000 (07:42 +0000)]
Auto merge of #5096 - eddyb:mac-name, r=oli-obk
Don't use ExpnKind::descr to get the name of a bang macro.
This is the same change as the first commit in rust-lang/rust#68407, but applied to clippy.
The new code should work both before and after the changes in rust-lang/rust#68407.
bors [Sat, 25 Jan 2020 17:47:54 +0000 (17:47 +0000)]
Auto merge of #5083 - Areredify:issue-4399, r=flip1995
dont fire `possible_missing_comma` if intendation is present
Closes #4399
changelog: dont fire `possible_missing_comma` if intendation is present
I suspect there is already a utils function for indentation (but searching indent didn't yield a function for that), and my solution is certainly not universal, but it's probably the best we can do.
bors [Sat, 25 Jan 2020 16:11:43 +0000 (16:11 +0000)]
Auto merge of #5081 - Areredify:vec_box_threshold, r=flip1995
add size parameter for `vec_box` lint
changelog: add size threshold for the `vec_box` lint, currently 4096 bytes (one page) (subject to change). Closes #3547.
diff is a little bit confusing due to some refactoring (moving free functions to lint struct functions), relevant portion is [this](https://github.com/rust-lang/rust-clippy/compare/master...Areredify:vec_box_threshold?expand=1#diff-1096120ca9143af89dcc9175ea92b54aR294-R298). In hindsight should've been different commits, but oh well.