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
Yuki Okushi
314f438ab4
Split up non_copy_const
ui test
2020-01-27 12:14:11 +09:00
Yuki Okushi
f5e86d6894
Rename span_note_and_lint
to span_lint_and_note
2020-01-27 11:26:42 +09:00
Yuki Okushi
f60f12f71f
Rename span_help_and_lint
to span_lint_and_help
2020-01-27 11:17:58 +09:00
bors
4f65bec39a
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
2020-01-26 15:28:39 +00:00
bors
fa046d2e7f
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
2020-01-26 10:50:47 +00:00
Philipp Hansch
45333102d7
Resolve FIXME: String::new is now a const fn
...
`const_string_new` is stable since Rust 1.39
2020-01-26 11:03:53 +01:00
bors
b6a976676c
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 .
changelog: none
2020-01-26 07:42:55 +00:00
Eduard-Mihai Burtescu
0e52a0ed6d
Don't use ExpnKind::descr to get the name of a bang macro.
2020-01-26 03:12:44 +02:00
Yuki Okushi
4b133f2867
Apply review comments
2020-01-26 07:01:16 +09:00
bors
fd6f609f64
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.
2020-01-25 17:47:54 +00:00
Mikhail Babenko
a234aef084
dont fire possible_missing_comma if intendation is present
2020-01-25 20:16:05 +03:00
bors
6b5419412e
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.
2020-01-25 16:11:43 +00:00
Mikhail Babenko
2b7bc260de
add size parameter for lint
2020-01-25 18:06:52 +03:00
bors
50f23ea3bc
Auto merge of #5090 - JohnTitor:split-up-match-same-arms, r=phansch
...
Split up `match_same_arms` ui test
Part of #2038
changelog: none
2020-01-25 07:28:31 +00:00
Yuki Okushi
83f6b516a0
Split up match_same_arms
ui test
2020-01-25 14:25:45 +09:00
bors
87597b5a42
Auto merge of #5087 - Areredify:issue-4905, r=phansch
...
improve `empty_enum` documentation
closes #4905
changelog: improve `empty_enum` help message and documentation.
2020-01-24 22:30:07 +00:00
bors
1ccd284ec6
Auto merge of #5086 - Areredify:issue-3746, r=phansch
...
don't fire `empty_loop` in `no_std` crates
closes #3746 .
changelog: move no_std detection to utils, don't fire empty_loop in no_std crates
2020-01-24 21:42:46 +00:00
bors
c48594c694
Auto merge of #5085 - JohnTitor:split-up-test, r=phansch
...
Split up `needless_range_loop` ui test
Part of #2038
changelog: none
2020-01-24 21:10:10 +00:00
Mikhail Babenko
634774b89b
don't fire empty_loop in no_std crates
2020-01-24 14:42:24 +03:00
Mikhail Babenko
199ae1714e
improve empty_enum documentation
2020-01-24 14:37:16 +03:00
Yuki Okushi
46b787d1b8
Split up needless_range_loop
ui test
2020-01-24 17:21:50 +09:00
Yuki Okushi
3999b30d9b
Update stderrs
2020-01-24 17:04:46 +09:00
Yuki Okushi
2dc73c45d5
Clean up methods/mod.rs
2020-01-24 17:04:37 +09:00
bors
2c7cfa8321
Auto merge of #5027 - sinkuu:vectored_io, r=phansch
...
Lint vectored IO in unused_io_amount lint
`read_vectored` & `write_vectored` require handling returned value likewise non-vectored methods. https://github.com/rust-lang/rust/issues/68041
---
changelog: lint vectored IO in `unused_io_amount` lint
2020-01-24 06:44:09 +00:00
bors
3237b7a69f
Auto merge of #5082 - Areredify:issue-4980, r=flip1995
...
disable let_underscore_must_use in external macros
changelog: disable let_underscore_must_use in external macros
Closes #4980
2020-01-23 18:29:28 +00:00
Mikhail Babenko
fef3657100
disable let_underscore_must_use in external macros
2020-01-23 20:02:34 +03:00
bors
6763447707
Auto merge of #4945 - Areredify:as_deref, r=flip1995
...
add `option_as_ref_deref` lint
changelog: add a new lint that lints `option.as_ref().map(Deref::deref)` (and similar calls), which could be expressed more succinctly as `option.as_deref[_mut]()`. Closes #4918 .
2020-01-23 16:56:48 +00:00
Areredify
796958c7e2
add option_as_ref_deref
lint
2020-01-23 16:12:16 +03:00
bors
eff3bc5e1e
Auto merge of #5079 - JohnTitor:fix-eq-op, r=flip1995
...
Ignore macros with `!` operators in `eq_op`
`SpanlessEq::eq_expr` doesn't ignore macros with `!` operators and I'm not sure we should ignore there, so I ignore in `eq_op` (and `op_ref`).
Fixes #5077
changelog: Fix false positive in `eq_op`
2020-01-22 11:36:04 +00:00
Yuki Okushi
a7d58edf27
Ignore macros with !
operators in eq_op
2020-01-22 16:48:00 +09:00
bors
3e74853d1f
Auto merge of #5075 - JohnTitor:rustup-0122, r=flip1995
...
Rustup to rust-lang/rust#68140
changelog: none
2020-01-21 22:35:15 +00:00