Commit graph

2962 commits

Author SHA1 Message Date
Cameron Steffen
28dec3b708 Add collapsible_match lint 2020-11-29 15:34:11 -06:00
Matthias Krüger
2838b04487 add internal-lints feature to enable clippys internal lints (off by default) 2020-11-29 21:07:43 +01:00
Suyash458
61b29281e7 add more tests for msrv 2020-11-29 17:08:56 +05:30
bstrie
d55d791a3a Update tests to remove old numeric constants
Part of #68490.

Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros.

For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-29 00:55:55 -05:00
Suyash458
4e4b8319e8 fix msrv in test 2020-11-28 21:21:04 -08:00
bors
68cf94f6a6 Auto merge of #6377 - CDirkx:redundant-pattern-match-ipaddr, r=ebroto
Enhance `redundant_pattern_matching` to also lint on `std::net::IpAddr`

Follow-up to #6339
r? `@ebroto`

(note: also contains a small cleanup of the other ui tests)

changelog: Enhance [`redundant_pattern_matching`] to also lint on `std::net::IpAddr`
2020-11-28 23:02:47 +00:00
bors
bc723c53a0 Auto merge of #6398 - rajcspsg:issue_6357, r=flip1995
issue_6357 update unreachable macro usage

changelog: none
2020-11-28 22:41:28 +00:00
bors
6cbb0930cd Auto merge of #6397 - matsujika:fix-6384, r=flip1995
Fix a false positive in `unnecessary_wraps`

Fix #6384

changelog: Fix FP in `unnecessary_wraps` that happens when `Call` expr has `Return` expr inside
2020-11-28 22:19:47 +00:00
Rajkumar Natarajan
76f2c10fb6 issue_6357 update unreachable macro usage 2020-11-28 14:55:13 -05:00
Hirochika Matsumoto
f7b2098e1c Fix a false positive in unnecessary_wraps 2020-11-29 01:55:15 +09:00
flip1995
0e5aee1fc1
items_after_statements: don't lint when they a separated by trailing semicolons 2020-11-28 17:18:15 +01:00
bors
7a73a25622 Auto merge of #6086 - Ryan1729:add-suspicious_chained_operators-lint, r=llogiq
Add suspicious_operation_groupings lint

This is my (<del> currently WIP </del>) attempt to close #6039.

changelog: Added `suspicious_operation_groupings` lint.
2020-11-28 08:17:25 +00:00
Camelid
2347eac4cc Update error to reflect that integer literals can have float suffixes
For example, `1` is parsed as an integer literal, but it can be turned
into a float with the suffix `f32`. Now the error calls them "numeric
literals" and notes that you can add a float suffix since they can be
either integers or floats.
2020-11-27 19:08:24 -08:00
Ryan1729
af1cc5c911 add suspicious_operation_groupings lint
run `cargo dev new_lint --category correctness --name suspicious_chained_operators --pass early`

add (currently failing) tests for suspicious_chained_operators
add some tests to answer a question that came up during implementation

write usage code for functions we'll need to find or create

Complete left-right tracking TODO

get it compiling with several `todo!` invocations.

refactor to a set of incomplete functions that don't expect to be able to edit a `Span`

create placeholder for `suggestion_with_swapped_ident` function and correct some comments

add `inside_larger_boolean_expression` test

fill out `get_ident` and `suggestion_with_swapped_ident`

Implementi the `IdentIter`

start on implementing the `IdentIter`
handle the `ExprKind::Path` case in `IdentIter`

on second thought, make the iterator type dynamic so we don't need an explicit type for each one we will need

handle `ExprKind::MacCall` in `IdentIter`

Try handling `box x` expressions

restructure `IdentIter`

set `self.done` when returning `None`

Handle `ExprKind::Array`

reduce duplication with a macro that we expect to use several more times

handle ExprKind::Call

add `new_p` convenience method

handle `MethodCall`

handle `Tup` and `Binary`

handle `Unary`

simplify by not returning an additional `Expr` from the `IdentIter`

add cross product test against false positives

rename suspicious_chained_operators to suspicious_operation_groupings within files

For the record, the exact commands run were:
find . -type f -name "*.md" -exec sed -i 's/suspicious_chained_operators/suspicious_operation_groupings/g' {} +

find . -type f -name "*.rs" -exec sed -i 's/suspicious_chained_operators/suspicious_operation_groupings/g' {} +

find . -type f -name "*.rs" -exec sed -i 's/SUSPICIOUS_CHAINED_OPERATORS/SUSPICIOUS_OPERATION_GROUPINGS/g' {} +

find . -type f -name "*.rs" -exec sed -i 's/SuspiciousChainedOperators/SuspiciousOperationGroupings/g' {} +

Also:
rename file to match module name

rename test file to match lint name

start implementing `IdentDifference` creation

add `IdentIter` utility

use `ident_iter::IdentIter`

fix bug in `suggestion_with_swapped_ident`

add `inside_if_statements` test

implement `Add` `todo`s

register `SuspiciousOperationGroupings` lint pass

fill in `chained_binops`, and fill in a stopgap version of `ident_difference_expr`, but then notice that the lint does not seem to ever be run in the tests

run `cargo dev update_lints` and not that the `suspicious_operation_groupings` lint still does not seem to be run

fix base index incrementing bug

fix paired_identifiers bug, and remove ident from `Single`

change help prefix and note our first successful lint messages!

add odd_number_of_pairs test

get the `non_boolean_operators` test passing, with two copies of the error message

extract `is_useless_with_eq_exprs` so we can know when `eq_op` will already handle something

add `not_caught_by_eq_op` tests since `s1.b * s1.b` was (reasonably) not caught by `eq_op`

cover the case where the change should be made on either side of the expression with `not_caught_by_eq_op` tests

produce the expected suggestion on the `not_caught_by_eq_op_middle_change_left` test

confirm that the previous tests still pass and update references

fix early continue bug and get `not_caught_by_eq_op_middle_change_right` passing

note that `not_caught_by_eq_op_start` already passes

fix bugs based on misunderstanding of what `Iterator::skip` does, and note that `not_caught_by_eq_op_end` now passes

add several parens tests and make some of them pass

handle parens inside `chained_binops_helper` and note that this makes several tests pass

get `inside_larger_boolean_expression_with_unsorted_ops` test passing by extracting out `check_same_op_binops` function

also run `cargo dev fmt`

note that `inside_function_call` already passes

add another `if_statement` test

remove the matching op requirement, making `inside_larger_boolean_expression_with_unsorted_ops` pass

prevent non-change suggestions from being emitted

get the `Nested` tests passing, and remove apparently false note about eq_op

add a test to justify comment in `ident_difference_expr_with_base_location` but find that the failure mode seems different than expected

complete `todo` making `do_not_give_bad_suggestions_for_this_unusual_expr` pass and add some more tests that already pass

add test to `eq_op`

note that `inside_fn_with_similar_expression` already passes

fix `inside_an_if_statement` and note that it already passes

attempt to implement if statement extraction and notice that we don't seem to handle unary ops correctly

add `maximum_unary_minus_right_tree` test and make it pass

add two tests and note one of them passes

filter out unary operations in several places, and find that the issue seems to be that we don't currently recognize the error in `multiple_comparison_types_and_unary_minus` even so.

remove filtering that was causing bad suggestions

remove tests that were deemed too much for now

run `cargo dev fmt`

correct eq_op post-merge

fill out the description and delete debugging code

run `cargo dev update_lints`

update eq_op references

add parens to work around rustfmt issue #3666 and run rustfmt

https://github.com/rust-lang/rustfmt/issues/3666#issuecomment-714612257

update references after formatting

fix dogfood issues

fix multi-cursor edit

fix missed dogfood error

fix more dogfood pedantic issues, including function length

even more nesting

insert hidden definition of Vec3 so docs compile

add spaces to second struct def

reword test description comment

Co-authored-by: llogiq <bogusandre@gmail.com>

add local `use BinOpKind::*;`

Apply suggestions from code review

Co-authored-by: llogiq <bogusandre@gmail.com>

switch `SUSPICIOUS_OPERATION_GROUPINGS` to a style lint

run `cargo dev update_lints`

put both usages of `op_types` in the same closure to satisfy `borrowck`

fix compile error
2020-11-27 17:50:16 -07:00
Markus Legner
82a7068007
Trigger modulo_one lint also on -1. 2020-11-27 08:54:35 +01:00
bors
403816fbc9 Auto merge of #6362 - nico-abram:unnecessary_cast_dot_float_literal, r=ebroto
Fix rust-lang/rust#79255 - Incorrect try suggestion for float cast

changelog: Fix rust-lang/rust#79255 - Incorrect try suggestion for float literal cast ending in dot
2020-11-26 08:41:16 +00:00
unknown
3b53de6b36 Fix rust-lang/rust#79255 - Incorrect try suggestion for unnecessary float literal cast ending in dot 2020-11-25 19:38:55 -03:00
PunitLodha
2345ef5b1f added lints str_to_string and string_to_string 2020-11-25 20:59:29 +05:30
flip1995
d06076c0c5
Add test for multiple defined msrv attrs 2020-11-25 12:23:28 +01:00
Suyash458
aaa4325045
add support for minimum supported rust version.
add configuration option for minimum supported rust version
add msrv attribute to some lints listed in #6097
add tests
2020-11-25 12:22:47 +01:00
Christiaan Dirkx
dc075b4266 Change redundant_pattern_matching to also lint std::net::IpAddr
Suggest using utility methods `is_ipv4` and `is_ipv6`.
2020-11-25 02:01:05 +01:00
bors
f897d27d8b Auto merge of #6339 - CDirkx:redundant-pattern-match-poll, r=ebroto
Change `redundant_pattern_matching` to also lint `std::task::Poll`

`reduntant_pattern_matching` currently lints pattern matching on `Option` and `Result` where the `is_variant` utility methods could be used instead: `is_some`, `is_none`, `is_ok`, `is_err`. This PR extends this behaviour to `std::task::Poll`, suggesting the methods `is_pending` and `is_ready`.

Motivation: The current description of `redundant_pattern_matching` mentions

> It's more concise and clear to just use the proper utility function

which in my mind applies to `Poll` as well.

changelog: Enhance [`redundant_pattern_matching`] to also lint on `std::task::Poll`
2020-11-24 23:19:43 +00:00
flip1995
c6a577ea11
Merge remote-tracking branch 'upstream/master' into rustup 2020-11-24 17:05:01 +01:00
bors
53ce1dd719 Auto merge of #79228 - flip1995:clippyup, r=oli-obk
Update Clippy

Biweekly Clippy update

r? `@Manishearth`
2020-11-24 06:56:02 +00:00
bors
295fe28057 Auto merge of #6313 - giraffate:fix_fp_needless_collect, r=ebroto
Fix FP in indirect `needless_collect` when used multiple times

Fix https://github.com/rust-lang/rust-clippy/issues/5991
Fix https://github.com/rust-lang/rust-clippy/issues/6297

changelog: Fix FP in indirect `needless_collect` when used multiple times
2020-11-23 22:26:45 +00:00
bors
d5b40bf469 Auto merge of #78343 - camelid:macros-qualify-panic, r=m-ou-se
Qualify `panic!` as `core::panic!` in non-built-in `core` macros

Fixes #78333.

-----

Otherwise code like this

    #![no_implicit_prelude]

    fn main() {
        ::std::todo!();
        ::std::unimplemented!();
    }

will fail to compile, which is unfortunate and presumably unintended.

This changes many invocations of `panic!` in a `macro_rules!` definition
to invocations of `$crate::panic!`, which makes the invocations hygienic.

Note that this does not make the built-in macro `assert!` hygienic.
2020-11-23 22:05:28 +00:00
Eduardo Broto
209ab1885c Merge remote-tracking branch 'upstream/master' into rustup 2020-11-23 23:02:12 +01:00
Camelid
d708b444e4 Qualify panic! as core::panic! in non-built-in core macros
Otherwise code like this

    #![no_implicit_prelude]

    fn main() {
        ::std::todo!();
        ::std::unimplemented!();
    }

will fail to compile, which is unfortunate and presumably unintended.

This changes many invocations of `panic!` in a `macro_rules!` definition
to invocations of `$crate::panic!`, which makes the invocations hygienic.

Note that this does not make the built-in macro `assert!` hygienic.
2020-11-23 11:28:25 -08:00
bors
58a2bc45d7 Auto merge of #6369 - camsteffen:cast-cfg, r=Manishearth
Disable unnecessary_cast for cfg-dependant types

changelog: Disable unnecessary_cast for cfg-dependant types

Fix  #6331
2020-11-23 16:33:13 +00:00
bors
723ac0faf1 Auto merge of #6317 - chansuke:add-external-macro, r=llogiq
Add exteranal macros for as_conversions

Added external macros to this PR https://github.com/rust-lang/rust-clippy/pull/4888.

r? `@llogiq`

changelog: none
2020-11-23 13:26:28 +00:00
flip1995
284c359c61 Fix ICE in utils::implements_trait
This only happend when debug_assertions were enabled in rustc
2020-11-23 13:52:27 +01:00
flip1995
d3d2018ead Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup 2020-11-23 13:51:04 +01:00
Cameron Steffen
a39a93faeb Disable unnecessary_cast for cfg-dependant types 2020-11-22 19:35:04 -06:00
Cameron Steffen
a8c47440b4 Use article_and_description for missing docs 2020-11-22 17:24:56 -06:00
Lzu Tao
4b698f2069 Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
oliver
e30bb7661d update 2020-11-22 00:50:09 -04:00
bors
8325d48d2d Auto merge of #6351 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-11-20 09:07:56 +00:00
flip1995
dd4e471b3f
Properly deprecate panic_params lint 2020-11-20 09:37:47 +01:00
Mara Bos
78faaef8de Remove the clippy::panic-params lint.
Rustc itself now warns for all cases that triggered this lint.
2020-11-19 18:34:40 +01:00
Takayuki Nakata
6494bd0bac Revert "Add rustfmt::skip as a work around"
This reverts commit 0e803417f9.

Fixed by https://github.com/rust-lang/rustfmt/issues/4528.
2020-11-18 12:36:47 +09:00
Christiaan Dirkx
5a83968877 Change redundant_pattern_matching to also lint std::task::Poll
Suggest using utility methods `is_pending` and `is_ready`.
2020-11-17 23:40:31 +01:00
bors
44d944586c Auto merge of #6070 - matsujika:unnecessary_wrap, r=flip1995
Add new lint `unnecessary_wrap`

Fixes #5969

changelog: New lint [`unnecessary_wraps`]
2020-11-17 20:28:32 +00:00
Camelid
4e4c4fb8aa Fix handling of panic calls
This should make Clippy more resilient and will unblock #78343.

This PR is made against rust-lang/rust to avoid the need for a subtree
sync at @flip1995's suggestion in rust-lang/rust-clippy#6310.
2020-11-17 12:16:15 -08:00
bors
5464cbed2f Auto merge of #6337 - ThibsG:FixIce6332, r=Manishearth
Remove `expect()` calls to avoid ICEs in `deref_addrof` lint

Fixes: #6332

changelog: none
2020-11-17 17:55:46 +00:00
Hirochika Matsumoto
c7445d7f2c Pluralize lint name 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
1f577c0300 Fix embarrassing grammatical error 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
4e5c02e898 Ignore trait implementations 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
4c8d248190 Update stderr files 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
86331a46e4 Update stderr files 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
30632fb8e6 Allow this lint on lint tests 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
c5447eb3c1 Make lint skip macros 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
12474c62ff Add support for methods 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
1bdac87128 Improve lint message 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
6b55f3fec9 Add test case 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
cdb72df6f9 Split lint suggestion into two 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
6a62390c86 Optout rustfix test 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
0e9d227c04 Add test cases 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
750c118b34 Add suggestion on type signatures 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
a7ac441760 Add new lint to detect unnecessarily wrapped value 2020-11-18 01:28:37 +09:00
ThibsG
5b8f2b6c93 Remove expect() calls to avoid ICEs in deref_addrof lint 2020-11-16 23:30:11 +01:00
bors
ad4f82997a Auto merge of #6119 - rsulli55:find_is_some_on_strs, r=flip1995
Add a case to `lint_search_is_some` to handle searching strings

Fixes: #6010

This adds a lint which recommends using `contains()` instead of `find()` followed by `is_some()` on strings as suggested in #6010.

This was added as an additional case to
5af88e3c2d/clippy_lints/src/methods/mod.rs (L3037)

I would really appreciate any comments/suggestions for my code!

changelog: Added case to `lint_search_is_some` to handle searching strings
2020-11-16 08:45:10 +00:00
bors
df3bb5881d Auto merge of #6336 - giraffate:sync-from-rust, r=flip1995
Rustup

changelog: none
2020-11-16 08:23:27 +00:00
Takayuki Nakata
0e803417f9 Add rustfmt::skip as a work around
because comments are checked and removed by rustfmt for some reason
2020-11-16 12:32:16 +09:00
bors
db0464103e Auto merge of #6334 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-11-15 13:09:53 +00:00
bors
0c7a48c5f0 Auto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obk
add error_occured field to ConstQualifs,

fix #76064

I wasn't sure what `in_return_place` actually did and not sure why it returns `ConstQualifs` while it's sibling functions return `bool`. So I tried to make as minimal changes to the structure as possible. Please point out whether I have to refactor it or not.

r? `@oli-obk`
cc `@RalfJung`
2020-11-14 18:03:17 +00:00
bors
408b615d34 Auto merge of #6320 - giraffate:fix_suggestion_in_manual_range_contains_using_float, r=llogiq
Fix suggestion in `manual_range_contains` when using float

Fix #6315

changelog: Fix suggestion in `manual_range_contains` when using float
2020-11-14 08:06:00 +00:00
Vishnunarayan K I
7987f39ad5 update clippy test ouput 2020-11-13 17:11:13 +05:30
bors
cf7b4b0fe6 Auto merge of #6329 - giraffate:sync-from-rust, r=matthiaskrgr
Rustup

changelog: none
2020-11-13 10:49:21 +00:00
Takayuki Nakata
8f89108533 Fix FP in indirect needless_collect when used multiple times 2020-11-12 23:29:16 +09:00
Takayuki Nakata
5f64867e1d Fix suggestion in manual_range_contains when using float 2020-11-11 22:44:48 +09:00
Fabian Zaiser
5f310d9b83 Implement destructuring assignment for structs and slices
Co-authored-by: varkor <github@varkor.com>
2020-11-11 12:10:52 +00:00
Ryan Sullivant
5c1c50ee17 Change variable named foo and rerun update-all-references 2020-11-10 23:48:01 -07:00
Ryan Sullivant
fd303132a2 Cleaned up message and suggestion for lint_search_is_some 2020-11-10 23:18:48 -07:00
Ryan Sullivant
ee1b959054 Added period back to lint search_is_some and ran
`update-all-references.sh`
2020-11-10 23:18:47 -07:00
Ryan Sullivant
55dc822062 Ran tests/ui/update-all-references.sh" and cargo dev fmt` 2020-11-10 23:18:47 -07:00
Ryan Sullivant
431fcbcc00 Moved the tests for lint search_is_some to new files
`search_is_some.rs` and `search_is_some_fixable.rs`
2020-11-10 23:18:47 -07:00
Ryan Sullivant
a1cf2d334d Added a lint as suggested in 6010 which recommends using contains()
instead of `find()` follows by `is_some()` on strings

Update clippy_lints/src/find_is_some_on_strs.rs
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Update clippy_lints/src/methods/mod.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-10 23:18:47 -07:00
bors
c4fc076e11 Auto merge of #6269 - camsteffen:map-clone-deref, r=ebroto
Fix map_clone with deref and clone

changelog: Fix map_clone false positive with deref coercion

Fixes #6239
2020-11-11 00:48:33 +00:00
Cameron Steffen
769094410a Fix map_clone with deref and clone 2020-11-10 18:37:17 -06:00
bors
d0858d0f36 Auto merge of #6303 - ThibsG:OptionOptionSerde, r=ebroto
Remove `allow` in `option_option` lint test

As it is not triggering locally anymore, I propose to remove `#[allow(clippy::option_option)]` from the test.

The goal is also to see what happens on CI.

closes: #4298

changelog: none
2020-11-10 22:39:10 +00:00
chansuke
faa3e23316 Add exteranal macros for as_conversions 2020-11-10 18:54:47 +09:00
bors
dd826b4626 Auto merge of #6305 - smoelius:master, r=flip1995
Add `let_underscore_drop`

This line generalizes `let_underscore_lock` (#5101) to warn about any initializer expression that implements `Drop`.

So, for example, the following would generate a warning:
```rust
struct Droppable;
impl Drop for Droppable {
    fn drop(&mut self) {}
}
let _ = Droppable;
```

I tried to preserve the original `let_underscore_lock` functionality in the sense that the warning generated for
```rust
let _ = mutex.lock();
```
should be unchanged.

*Please keep the line below*
changelog: Add lint [`let_underscore_drop`]
2020-11-09 19:13:26 +00:00
Samuel E. Moelius III
4852cca61b Allow let_underscore_drop in filter_methods test 2020-11-09 07:49:14 -05:00
bors
d212c382c3 Auto merge of #6278 - ThibsG:DerefAddrOf, r=llogiq
Fix bad suggestions for `deref_addrof` and `try_err` lints

Fix bad suggestions when in macro expansion for `deref_addrof` and `try_err` lints.

Fixes: #6234
Fixes: #6242
Fixes: #6237

changelog: none

r? `@llogiq`
2020-11-09 05:25:04 +00:00
Samuel E. Moelius III
06e81bb493 Update references 2020-11-08 18:32:12 -05:00
Cameron Steffen
9cab08465b Fix or_fun_call for index operator 2020-11-08 14:49:42 -06:00
Samuel E. Moelius III
9c6a0b9c34 Update references 2020-11-08 07:07:49 -05:00
bors
b1faa7f002 Auto merge of #6271 - camsteffen:vec-box-import, r=flip1995
Fix vec_box scope error

changelog: Fix vec_box suggestion with wrong type scope

Fixes #6236
2020-11-08 12:02:30 +00:00
Samuel E. Moelius III
f1f780c942 Add let_underscore_drop 2020-11-08 07:00:35 -05:00
flip1995
00dee9d916
Update reference files 2020-11-08 12:40:41 +01:00
Joe Richey
c6a91df838
Enable empty_loop lint for no_std crates
We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-11-08 12:38:10 +01:00
bors
96d5f45ade Auto merge of #6301 - alex-700:fix-map-clone, r=matthiaskrgr
do not trigger map_clone in the case of &mut

fixes #6299
changelog: do not trigger map_clone in the case of &mut
2020-11-08 01:28:27 +00:00
bors
92ba07582e Auto merge of #6134 - patrickelectric:as_utf8, r=llogiq
Check when `from_utf8` is called from sliced byte array from string

---

*Please keep the line below*
changelog: Fix #5487: Add linter to check when `from_utf8` is called from sliced byte array from string.
2020-11-07 17:06:27 +00:00
bors
694cec12be Auto merge of #6110 - rail-rain:care_enums_non_copy_const, r=llogiq
"Respect" enums in `interior_mutable_const`

fixes #3962
fixes #3825

Hello,

It might not be a good idea to submit another relatively large PR while I have an opened PR; but, I've finished this anyway. This may be able to wait for months.

Note: the code uses the MIR interpreter, which the author of #3962 thought unlikely to be a solution. This might be over-engineering; but, I think it's important to be able to work with the 'http' crate (#3825). (And, I don't want to write a MIR visitor)

---

changelog: fix a false positive in two `interior_mutable_const` lints where a constant with enums gets linted
even if it uses a clearly unfrozen variant
2020-11-07 15:51:13 +00:00
bors
4bbef42c48 Auto merge of #6272 - camsteffen:unnecesary-lazy-eval-type, r=llogiq
Fix unnecessary_lazy_eval suggestion applicability

changelog: Fix unnecessary_lazy_eval suggestion applicability when breaking type inference

Fixes #6240
2020-11-07 10:01:46 +00:00
ThibsG
8242b2f0a4 Remove needless allow 2020-11-06 18:11:58 +01:00
Aleksei Latyshev
5f57608604
do not trigger map_clone in the case of &mut 2020-11-06 14:38:46 +03:00
Takayuki Nakata
1624b00bde Fix suggestion to add unneeded space in manual_async 2020-11-06 08:40:43 +09:00
ThibsG
83e75f9207 Fix incorrect suggestion for try_err lint when Err arg is itself a macro 2020-11-05 18:00:34 +01:00
flip1995
34244190d4 Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup 2020-11-05 14:29:48 +01:00