Commit graph

4638 commits

Author SHA1 Message Date
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
bors
9408c68c1d Auto merge of #6105 - bugadani:sus-char, r=ebroto
Lint for invisible Unicode characters other than ZWSP

This PR extends the existing `zero_width_space` lint to look for other invisible characters as well (in this case, `\\u{ad}` soft hyphen.

I feel like this lint is the logical place to add the check, but I also realize the lint name is not particularly flexible, but I also understand that it shouldn't be renamed for compatibility reasons.

Open questions:
 - What other characters should trigger the lint?
 - What should be done with the lint name?
 - How to indicate the change in functionality?

Motivation behind this PR: https://github.com/rust-lang/rust/issues/77417 - I managed to shoot myself in the foot by an invisible character pasted into my test case.

changelog: rename [`zero_width_space`] to [`invisible_characters`] and add SHY and WJ to the list.
2020-10-02 22:22:37 +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
Long Louis Bui
8b8c63f568 changed non_copy_const lints to warn by default 2020-10-02 23:12:40 +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
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
aa2ac38fa7 needless-lifetime / add known problem item 2020-09-30 00:08:19 +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
Eduardo Broto
8bf27c5e92 Fix dogfood 2020-09-27 15:22:33 +02:00
Eduardo Broto
cd4706413f Run cargo dev fmt 2020-09-27 15:17:13 +02:00
Eduardo Broto
798a5cf5bc Merge remote-tracking branch 'upstream/master' into rustup 2020-09-27 15:09:52 +02:00
Jeremiah Senkpiel
00e641b914 lints: clarify rc_buffer and add caveats
This didn't display some types properly in the docs due the lack of code formatting.

Also, refs for the caveat:
https://github.com/rust-lang/rust-clippy/pull/6044#issuecomment-699559082
https://github.com/http-rs/surf/pull/242
2020-09-26 17:19:12 -07: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
Oliver Scherer
7072e45c6c Remove all unstable feature support in the missing_const_for_fn lint 2020-09-26 16:23:56 +02:00
Takayuki Nakata
83294f894d Some small fixes 2020-09-26 23:10:25 +09:00
Oliver Scherer
a6fda14394 Move qualify_min_const_fn out of rustc into clippy 2020-09-26 16:08:24 +02: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
3886edb05a fix error message 2020-09-25 11:09:04 -05:00
Frank
725a0ef8b1 change config variables to reference, remove wildcard import 2020-09-25 11:09:04 -05:00
Frank
e1b3f85e98 run cargo dev fmt 2020-09-25 11:09:04 -05:00
Frank
12e5637f75 update unused variable 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
6273be6fc2 Auto merge of #77144 - flip1995:clippyup, r=Manishearth
Update Clippy

Bi-weekly Clippy update.

This includes a `Cargo.lock` update (d445493479), so probably needs `rollup=never`.

r? `@Manishearth`
2020-09-25 06:23:55 +00:00
Jonas Schievink
a8c6073278 Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr
Allow a unique name to be assigned to dataflow graphviz output

Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.
2020-09-25 02:29:31 +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
Robin Schoonover
6c056d3465 Satisfy rc_buffer lint in Constant::Binary byte string by copying data
We can avoid the data copy again by fixing rustc_ast::ast::LitKind
later.
2020-09-22 20:35:54 -06: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
6e07247578 Merge remote-tracking branch 'upstream/master' into rustup 2020-09-21 15:11:24 +02:00
Christiaan Dirkx
141b9c2890 Remove can_suggest from Clippy.
Removes `can_suggest` from as it is no longer used.
Reverts rust-clippy#5724.
2020-09-21 00:00:33 +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