Commit Graph

537 Commits

Author SHA1 Message Date
Marcel Hellwig
5572476a36 Add lint for debug_assert_with_mut_call
This lint will complain when you put a mutable function/method call
inside a `debug_assert` macro, because it will not be executed in
release mode, therefore it will change the execution flow, which is not
wanted.
2019-10-22 10:39:55 +02:00
Heinz N. Gies
7f454d8d06 Split out tests 2019-10-18 07:40:48 +02:00
Heinz N. Gies
98dc3aabea Add todo and tests 2019-10-18 07:37:58 +02:00
HMPerson1
76b44f34b9
Add inefficient_to_string lint 2019-10-16 15:54:20 -04:00
James Wang
664522badd
Add a new lint for unused self 2019-10-15 09:58:11 +02:00
Andre Bogus
cc622608db new lints around #[must_use] fns
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.

`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.

`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
bors
db233b0920 Auto merge of #4616 - mati865:license, r=Manishearth
Fix license in Cargo.toml files

Missed in https://github.com/rust-lang/rust-clippy/pull/3269

changelog: none

r? @Manishearth
2019-10-09 16:09:26 +00:00
Nikos Filippakis
5143fe1a78 New lint: suspicious_unary_op_formatting
Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).

Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
2019-10-09 16:22:00 +02:00
Ethan Lam
327c91f8c7 Addresses Issue #4001
Fixed typo

Fixes lint name and uses appropriate linting suggestion

changed lint help message

Added autofixable test

Added Autofixable Test

Removed Broken Autofixable File

updated lints

Generated Autofixable/Nonfixable Test Cases

Changed Suggestion Applicability

Updated Lint Count
2019-10-08 08:46:29 -05:00
Mateusz Mikuła
4f1d907462 Use new format of licenses
Co-Authored-By: lzutao <taolzu@gmail.com>
2019-10-04 17:40:32 +02:00
Andre Bogus
27fa2b7944 New lint: unsound_collection_transmute 2019-10-02 21:18:00 +02:00
Andre Bogus
23a9c02120 New lint: needless_doc_main 2019-10-02 17:17:22 +02:00
James Wang
52408f5b7d
Add a new lint for comparison chains 2019-09-24 16:55:05 -05:00
Michael Wright
d04bf15114 Merge branch 'master' into unneeded_wildcard_pattern 2019-09-22 08:59:23 +02:00
Andre Bogus
8d884c8a1a new lint: mem-replace-with-uninit 2019-09-20 00:25:57 +02:00
Andre Bogus
70a7dab773 New lint: Require # Safety section in pub unsafe fn docs 2019-09-19 09:19:55 +02:00
Michael Wright
4a3bc6b592 Add unneeded-wildcard-pattern lint 2019-09-12 08:25:05 +02:00
Shotaro Yamada
4960f79476 Add manual_saturating_arithmetic lint 2019-09-04 18:38:25 +09:00
Andre Bogus
b01f2d1126 lint against MaybeUninit::uninit().assume_init() 2019-09-03 17:37:38 +02:00
Lzu Tao
7065239da5 Add option_and_then_some lint 2019-08-19 03:54:40 +00:00
Jeremy Stucki
f4f31a4ff4
Implement lint 'suspicious_map' 2019-08-15 22:58:32 +02:00
Philipp Hansch
42f03539ca
Deprecate unused_collect lint
I found this because we only had two test cases in total for this lint.
It turns out the functionality is fully covered by rustc these days.

[Playground Examples](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eb8ee6db389c77180c9fb152d3c608f4)

changelog: Deprecate `unused_collect` lint. This is fully covered by
rustc's `#[must_use]` on `collect`

cc #2846
2019-08-14 21:47:11 +02:00
Jeremy Stucki
6ddf8c36d7
Run 'update_lints' 2019-08-12 07:53:22 +02:00
Ralf Jung
40fea7a9e0 update_lints 2019-08-11 11:02:25 +02:00
Alex Touchet
b1b2245e28
Fix HTTPS in links 2019-08-08 19:59:22 -07:00
Matthias Krüger
39cdea6df4
Update README.md (fix typo)
Co-Authored-By: Philipp Hansch <dev@phansch.net>
2019-08-07 21:07:35 +02:00
Matthias Krüger
8dde4e5806 README: mention that cargo fix has experimental support for applying some clippy lint suggestions via "cargo fix -Z unstable-options --clippy" 2019-08-07 16:27:08 +02:00
Alex Touchet
4b2825cd3f
Update Readme 2019-08-06 13:09:26 -07:00
flip1995
a922f800af
Run update_lints and fmt 2019-08-05 13:24:31 +02:00
xd009642
925e8207fa Respond to review comments
Update README and CHANGELOG using the util scripts, refine the help message and fix the float_cmp error.
2019-07-27 21:58:29 +01:00
Darth-Revan
0513202d25
Implement lint for inherent to_string() method. 2019-07-17 08:58:32 +02:00
Matthias Krüger
1bd081c600 readme: fix urls in the license 2019-07-02 20:06:18 +02:00
Joe Frikker
60a80849ce Adding try_err lint 2019-06-22 16:37:05 -04:00
Matthias Krüger
e8dfafc7a0 readme: update
Remove the crates.io badge from the readme.
Installing clippy via crates.io is deprecated and rustup should be used instead, thus we should not promote crates.io here.

Don't have the entire clippy::correctness line in bold letters, I think it looks a little off.
2019-06-20 20:17:14 +02:00
Thiago Arrais
b364eb7b54 Adds lint for integer division 2019-06-12 09:37:14 -03:00
Harrison McCullough
f32c2fcb7e Implement get_last_with_len lint 2019-05-20 18:01:21 -06:00
pJunger
565feb0bc1 Updated README. 2019-05-18 14:53:56 +02:00
Michael Wright
4fcaab3d62 Split redundant_closure lint
Move the method checking into a new lint called
`redundant_closures_for_method_calls` and put it in the pedantic group.

This aspect of the lint seems more controversial than the rest.

cc #3942
2019-05-16 08:25:39 +02:00
André Luis Leal Cardoso Junior
b411391f8e Add lints for find_map 2019-04-30 16:45:28 -03:00
André Luis Leal Cardoso Junior
7e9cb5b84a Add lint PathBufPushOverwrite 2019-04-18 08:05:55 -03:00
Philipp Krones
a7bfac7353 Update README.md
Co-Authored-By: sunjay <sunjay@users.noreply.github.com>
2019-04-10 22:17:17 -04:00
Sunjay Varma
5fab7ec002
Mention that -D warnings will deny ALL warnings, not just clippy warnings 2019-04-08 13:51:54 -04:00
Félix Fischer
069957a8ad Add TransmutingNull Lint
* Late Lint pass, catches:
  * One liner: 0 -> null -> transmute
  * One liner: std:null() -> transmute
  * Const (which resolves to null) -> transmute
* UI Test case for Lint
* Updated test for issue 3849, because now the lint that code generated is in Clippy.
* Expanded `const.rs` miri-based Constant Folding code, to cover
  raw pointers
2019-04-02 11:39:43 -03:00
bors
920112d723 Auto merge of #3824 - phansch:adding_lints, r=phansch
Add lint writing documentation

[Rendered](https://github.com/phansch/rust-clippy/blob/adding_lints/doc/adding_lints.md)

This adds a new documentation page that explains how to write Clippy
lints. It guides the reader through creating a `foo` function lint.

I plan to iterate a bit more on the prose of some sections, but I think the
general structure is fine now, so I'm looking forward to feedback =)

One thing I'm not sure about: I felt like this is too big for CONTRIBUTING.md
so I put it into a new `doc/` directory. I can imagine having more
documentation in the future, so we might even want to create a book using
mdbook instead? Or should everything go into CONTRIBUTING.md?

Further things left to do:

- [x] Link from CONTRIBUTING.md
- [x] Remove things covered in this guide from CONTRIBUTING.md
- [x] Section about `clippy::author` attribute
- [x] Run `remark-lint` on CI over the `doc` directory and fix things
2019-03-09 15:05:38 +00:00
Félix Fischer
ddc718087f Renamed: Cyclomatic Complexity -> Cognitive Complexity
* Ran automatic naming update

* Formalized rename of `cyclomatic_complexity` to `cognitive_complexity`
** Added the rename to `lib.rs`
** Added rename test

* Added warning for deprecated key `cyclomatic_complexity_threshold` and tests for it

* Added deprecation status for Clippy's builtin attribute

* Updated tests for new builtin attribute renaming
2019-03-06 10:07:38 -03:00
Philipp Hansch
0da3521eb6
Reword 'Setup' a bit 2019-03-03 15:03:25 +01:00
Wilfred Hughes
4f8c1d100d
Fix broken markdown in README.md 2019-02-23 00:20:57 +00:00
Manish Goregaokar
50f1dd6af8 Clarify lint groups in readme 2019-02-22 13:29:33 +05:30
Michael Howell
cb1c0b6849 Update README and CHANGELOG 2019-02-17 22:53:08 -07:00
rhysd
83d620b824 run util/dev update_lints and cargo fmt --all 2019-02-03 21:56:24 +09:00