Commit graph

3631 commits

Author SHA1 Message Date
FliegendeWurst 428ef362d6 Fix test formatting 2020-10-05 12:23:01 +02:00
FliegendeWurst 78695bd496
Do not lint float fractions in mistyped_literal_suffixes (fixes #4706) 2020-10-05 12:09:21 +02:00
bors 2ed5143c0e Auto merge of #6111 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: Deprecate [`drop_bounds`] lint. This lint was uplifted to rustc with the same name.
2020-10-04 12:04:31 +00:00
Dániel Buga 572e4c4837 Add WJ 2020-10-03 00:07:56 +02:00
Dániel Buga 998bd3b6b4 Rename lint to invisible_characters 2020-10-03 00:03:33 +02:00
Michael Howell 840f7daaad Deprecate clippy lint 2020-10-02 11:34:14 -07:00
Dániel Buga 515ca93123 Look for soft hyphens as well 2020-10-02 11:56:21 +02:00
Michael Wright e91202cf68 Allow exponent separator
Fixes #6096
2020-10-02 07:02:58 +02:00
bors 8c9800a3a9 Auto merge of #6102 - giraffate:no_lint_when_invalid_suggestion_in_needless_range_loop, r=flip1995
Don't emit a lint for the suggestion leading to errors in `needless_range_loop`

Fix #5945

changelog: Don't emit a lint for the suggestion leading to errors in `needless_range_loop`
2020-10-01 16:29:08 +00:00
Takayuki Nakata 0a91fe7016 Don't emit a lint for the suggestion leading to errors in needless_range_loop 2020-10-02 00:49:05 +09:00
bors d4313737d8 Auto merge of #5978 - montrivo:needless-lifetime, r=ebroto
needless-lifetime - nested elision sites

Closes #2944

changelog: fix needless-lifetime nested elision site FPs
2020-10-01 13:43:24 +00:00
bors abce9e7c9f Auto merge of #6092 - jethrogb:jb/inline-asm-syntax-lint, r=ebroto
Add lint for inline assembly syntax style preference

changelog: Add lint for inline assembly syntax style preference
2020-09-30 21:44:29 +00:00
Eduardo Broto 507561ecfc
Update tests/ui/asm_syntax.rs
Use a single `only` header command in asm_syntax test
2020-09-30 23:30:49 +02:00
Jethro Beekman 0690f9c5d5 Add lint for inline assembly syntax style preference 2020-09-30 09:43:46 +02:00
Tim Nielens cb2be6f9db needless-lifetime / pr remarks 2020-09-30 00:33:46 +02:00
Tim Nielens 124420f920 needless-lifetime / fix master merge 2020-09-29 23:06:08 +02:00
Tim Nielens 7cfe3dc2eb Merge branch 'master' into needless-lifetime 2020-09-29 22:51:59 +02:00
Eduardo Broto 101e76f117 needless arbitrary self: handle macros 2020-09-28 19:17:22 +02:00
bors ea079eb8a4 Auto merge of #6081 - ilknarf:master, r=matthiaskrgr
New Lint: disallowed_method

Fixes https://github.com/rust-lang/rust-clippy/issues/6073

I added a `disallowed_method` lint that works similar to `blacklisted_name`, e.g allows config-defined disallowed method calls.

This lint allows advanced users to patch in undesired method calls for specific projects. It basically uses the DefId of method calls and matches it to parsed strings. Is there an alternative approach that could use more easily digestible configuration strings?

All tests pass as expected except for a linting error on `ui/redundant_pattern_matching_option`, which I am not sure how to resolve since I don't think I changed anything affecting it.

changelog: Add disallowed_method lint to warn on user-defined method calls
2020-09-26 20:55:53 +00:00
bors b64d21d980 Auto merge of #6079 - giraffate:print_stdout_in_build_rs, r=ebroto
Fix FP in `print_stdout`

Fix #6041

This lint shouldn't be emitted in `build.rs` as `println!` and `print!` are used for the build script.

changelog: none
2020-09-26 20:34:35 +00:00
Takayuki Nakata 83294f894d Some small fixes 2020-09-26 23:10:25 +09:00
Frank d18653158d remove useless test, update disallowed_method description 2020-09-25 11:09:04 -05:00
Frank f9da2946d8 update error message, refactor disallowed_method 2020-09-25 11:09:04 -05:00
Frank 9eb52d2eb6 update toml_unknown_key test 2020-09-25 11:09:04 -05:00
Frank e1b3f85e98 run cargo dev fmt 2020-09-25 11:09:04 -05:00
Frank 1479c18396 add disallowed_method lint 2020-09-25 11:09:04 -05:00
Takayuki Nakata 5b484b4057 Fix the detection of build scripts 2020-09-25 23:32:18 +09:00
bors 6e5306dcc3 Auto merge of #6084 - ebroto:ui_tests_cleanup, r=flip1995
UI tests cleanup

`@matthiaskrgr` noticed some `run-pass` annotations in some crash tests that were added in #3922. At that moment they seemed to be necessary to make the tests fail in case of an ICE, but they do not seem to be needed anymore. To test this I forced an ICE in a file with and without annotations, with and without stderr files, and the ICE makes the test fail every time.

In addition, I've applied a suggestion from `@ehuss` and `@jyn514` to add `emit=metadata` to the rustc flags for the UI tests. In my machine this improved the run time from ~17 to ~12 seconds.

changelog: none
2020-09-25 14:14:25 +00:00
Eduardo Broto 1cb3c00cba Use emit=link for auxiliary proc macro crates 2020-09-25 15:46:32 +02:00
Eduardo Broto fd0656109f Add emit=metadata to UI tests build flags
This should improve the performance by avoiding codegen
2020-09-25 15:20:04 +02:00
Eduardo Broto 6b59675449 Remove run-pass annotations from crash tests
It does not seem to be necessary
2020-09-25 15:19:36 +02:00
Takayuki Nakata 2892a2b0f5 Fix FP in print_stdout
This lint shouldn't be emitted in `build.rs` as `println!` and `print!` are used for the build script.
2020-09-24 23:22:54 +09:00
bors cc1998f7b3 Auto merge of #6077 - ebroto:revert_or_fun_call_const, r=matthiaskrgr
Revert: or_fun_call should lint calls to `const fn`s with no args

The changes in #5889 and #5984 were done under the incorrect assumption that a `const fn` with no args was guaranteed to be evaluated at compile time.  A `const fn` is only guaranteed to be evaluated at compile time if it's inside a const context (the initializer of a `const` or a `static`).

See this [zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Common.20misconception.3A.20.60const.20fn.60.20and.20its.20effect.20on.20codegen/near/208059113) for more details on this common misconception.

Given that none of the linted methods by `or_fun_call` can be called in const contexts, the lint should make no exceptions.

changelog: [`or_fun_call`] lints again calls to `const fn` with no args
2020-09-24 14:14:53 +00:00
bors 019c0d5f7f Auto merge of #6076 - rail-rain:fix_fp_explicit_counter_loop, r=matthiaskrgr
Fix a FP in `explicit_counter_loop`

Fixes #4677 and #6074

Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented, adjust the test so that counters are incremented at the end of the loop and add the test for this false positive.

---

changelog: Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented
2020-09-24 13:45:24 +00:00
flip1995 d1f9cad102 Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup 2020-09-24 14:49:22 +02:00
bors e636b88aa1 Auto merge of #6044 - rschoon:rc-buffer, r=yaahc
Add `rc_buffer` lint for checking Rc<String> and friends

Fixes #2623

This is a bit different from the original PR attempting to implement this type of lint.   Rather than linting against converting into the unwanted types, this PR lints against declaring the unwanted type in a struct or function definition.

I'm reasonably happy with what I have here, although I used the fully qualified type names for the Path and OsString suggestions, and I'm not sure if I should have just used the short versions instead, even if they might not have been declared via use.

Also, I don't know if "buffer type" is the best way to put it or not.  Alternatively I could call it a "growable type" or "growable buffer type", but I was thinking of PathBuf when I started making the lint.

changelog: Add `rc_buffer` lint
2020-09-23 18:35:08 +00:00
Eduardo Broto ce83d8d4d1 Revert "Avoid or_fun_call for const_fn with no args"
This reverts commit 5d66bd7bb3.
2020-09-23 00:39:00 +02:00
Eduardo Broto 3e294b22a4 Revert "or_fn_call: ignore nullary associated const fns"
This reverts commit 7a66e6502d.
2020-09-23 00:34:56 +02:00
rail 5e393c7747 Fix a FP in explicit_counter_loop
Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented,
adjust the test so that counters are incremented at the end of the loop
and add the test for this false positive.
2020-09-23 08:15:44 +12:00
Aleksei Latyshev d4f158fa5c
Forbid redundant_pattern_matching triggering in macros
- remove ice-2636 test
2020-09-21 20:49:42 +03:00
Eduardo Broto 4117ae1175 Split redundant_pattern_matching tests
This is to avoid the 200 lines stderr file limit
2020-09-21 15:32:26 +02:00
Eduardo Broto 6e07247578 Merge remote-tracking branch 'upstream/master' into rustup 2020-09-21 15:11:24 +02:00
Christiaan Dirkx ed43385cab Update Clippy testcases
Update the test `redundant_pattern_matching`: check if `is_some` and `is_none` are suggested within const contexts.
2020-09-20 23:59:34 +02:00
bors a334ae658b Auto merge of #76136 - CDirkx:const-result, r=dtolnay
Stabilize some Result methods as const

Stabilize the following methods of Result as const:
 - `is_ok`
 - `is_err`
 - `as_ref`

A test is also included, analogous to the test for `const_option`.

These methods are currently const under the unstable feature `const_result` (tracking issue: #67520).
I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463) and [PR#76135](https://github.com/rust-lang/rust/pull/76135).

Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature.

Related: #76225
2020-09-20 13:07:11 +00:00
Christiaan Dirkx 10d272b2e2 Update Clippy testcases
Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts.
Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.
2020-09-20 03:32:36 +02:00
rail d5af360bb2 add WRAPPED_SELF: Option<Self> in the test 2020-09-17 21:14:14 +12:00
rail 2fc9064921 rewrite the test and fix a minor fp
* rewrite the test for `declare_interior_mutable_const from scratch`

* fix a minor false positive where `Cell<"const T>` gets linted twice
2020-09-17 19:48:40 +12:00
rail d655c0a938 Change the criteria of interior_mutable_const
* stop linting associated types and generic type parameters
* start linting ones in trait impls
  whose corresponding definitions in the traits are generic
* remove the `is_copy` check
  as presumably the only purpose of it is to allow
  generics with `Copy` bounds as `Freeze` is internal
  and generics are no longer linted
* remove the term 'copy' from the tests
  as being `Copy` no longer have meaning
2020-09-17 19:38:37 +12:00
rail 2ce2d6b40e fix a FP in indexing_slicing
treat refs to arrays the same as arrays
in `indexing_slicing` and `out_of_bounds_indexing`
2020-09-17 10:11:10 +12:00
bors 06f1902878 Auto merge of #5937 - montrivo:option_if_let_else, r=flip1995
option_if_let_else - distinguish pure from impure else expressions

Addresses partially #5821.

changelog: improve the lint `option_if_let_else`. Suggest `map_or` or `map_or_else` based on the else expression purity.
2020-09-16 19:36:49 +00:00