Commit graph

2951 commits

Author SHA1 Message Date
ThibsG
badfbbbbde Fix single binding in closure 2020-03-22 10:31:30 +01:00
bors
0e5e2c4365 Auto merge of #5323 - rabisg0:fix/5284, r=flip1995
Improvement: Don't show function body in needless_lifetimes

Changes the span on which the lint is reported to point to only the
function return type instead of the entire function body.
Fixes #5284

changelog: none
2020-03-20 12:45:30 +00:00
Philipp Krones
983d195bb5
Rollup merge of #5333 - matthiaskrgr:rustup_34, r=flip1995
rustup https://github.com/rust-lang/rust/pull/69189

rustups https://github.com/rust-lang/rust/pull/69189 which is part of https://github.com/rust-lang/rust/pull/70085
(at least I think this is the only pr that changes clippy test stdout)

changelog: none
2020-03-19 15:00:30 +01:00
Rabi Guha
0812a0af4c Improvement: Don't show function body in needless_lifetimes
Changes the span on which the lint is reported to point to only the
function return type instead of the entire function body.
Fixes #5284
2020-03-19 12:03:02 +05:30
Matthias Krüger
ec1dcde46b tests: arithmetic: split into integer_arithmetic and float_arithmetic files. 2020-03-18 15:50:01 +01:00
flip1995
a808779441
Split up checked_unwrap test further 2020-03-18 15:26:24 +01:00
Matthias Krüger
c7c7ab23aa integer_arithmetic: detect integer arithmetic on references.
Also fixes the same for float_arithmetic.

changelog: integer_arithmetic,float_arithmetic: fix false negatives with references on integers

Fixes #5328
2020-03-18 14:52:01 +01:00
Matthias Krüger
b875c53d2c rustup https://github.com/rust-lang/rust/pull/69189
rustups https://github.com/rust-lang/rust/pull/69189 which is part of https://github.com/rust-lang/rust/pull/70085
(at least I think this is the only pr that changes clippy test stdout)
2020-03-18 03:27:05 +01:00
Lzu Tao
9febcf5e8d Don't convert Path to lossy str 2020-03-14 22:20:16 +07:00
Lzu Tao
6be0220967 Use into_path 2020-03-14 22:20:16 +07:00
Lzu Tao
29df0139dc Use pattern matching instead of manually checking condition 2020-03-14 19:29:48 +07:00
Philipp Krones
626f2fe1cb
Fix typo
Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
2020-03-14 10:22:49 +01:00
Eric Huss
34a00fe7f4 Remove git2 dependency. 2020-03-13 18:22:51 -07:00
Shotaro Yamada
d9ad33852c Use visit_place 2020-03-13 02:06:47 +09:00
Shotaro Yamada
aca64b8df7 Check for mutation 2020-03-13 01:25:18 +09:00
Shotaro Yamada
9de642190e Extend redundant_clone to the case that cloned value is not consumed 2020-03-13 00:31:09 +09:00
bors
fdce47ba7d Auto merge of #5272 - jmeyers35:file_read_lint, r=flip1995
add lint on File::read_to_string and File::read_to_end

Adds lint `verbose_file_reads` which checks for use of File::read_to_end and File::read_to_string.

Closes https://github.com/rust-lang/rust-clippy/issues/4916

changelog: add lint on File::{read_to_end, read_to_string}
2020-03-10 22:35:15 +00:00
bors
9d5ffe8105 Auto merge of #5300 - JohnTitor:edition-flag, r=flip1995
Use `edition:2018` flag more widely

Now we recommend using `// edition:2018`, so let's use it more widely.
Also replace a too old example with new one in the docs.

changelog: none
2020-03-10 22:02:41 +00:00
Jacob Meyers
a4ba1027fc add CR feedback 2020-03-10 18:00:37 -04:00
Yuki Okushi
515847dad1
Use edition:2018 flag more widely 2020-03-11 06:35:07 +09:00
bors
23bd427f92 Auto merge of #5298 - rust-lang:needless_doc_main_code, r=flip1995,Manishearth
needless_doc_main: only check rust code

This fixes #5280 by checking the language attribute on code blocks.

---

changelog: none
2020-03-10 21:30:44 +00:00
Manish Goregaokar
d5c8b783b8
Update tests/ui/needless_doc_main.rs
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-03-10 14:30:07 -07:00
Andre Bogus
2fa3da4869 needless_doc_main: only check rust code 2020-03-10 20:19:37 +01:00
bors
557f6848bd Auto merge of #5296 - sinkuu:fix_ice_trivial_bounds, r=flip1995
Fix ICE with trivial_bounds feature

https://github.com/rust-lang/rust/issues/69874#issuecomment-596890446

changelog: Fix ICE with trivial_bounds feature
2020-03-10 12:25:07 +00:00
Yuki Okushi
8d2a3e0a61
Use node_type_opt over node_type 2020-03-10 18:18:34 +09:00
Shotaro Yamada
a3d9355bef Fix ICE with trivial_bounds feature 2020-03-10 13:17:35 +09:00
Jacek Pospychala
697e3c89a7 Improve placeholder in map_unit_fn 2020-03-09 20:37:06 +01:00
bors
d8f64b6eba Auto merge of #5287 - matthiaskrgr:pat_isref, r=flip1995
redundant_pattern: take binding (ref, ref mut) into account in suggestion

fixes #5271

changelog: redundant_pattern: take binding (ref, ref mut) into account in suggestion (#5271)
2020-03-09 17:25:09 +00:00
bors
118594ffa2 Auto merge of #5291 - ThibsG:FixSingleBinding, r=flip1995
Fix match single binding when in a let stmt

Fix bad suggestion when `match_single_binding` lints when inside a local (let) statement.

Fixes #5267

changelog: none
2020-03-09 16:04:26 +00:00
ThibsG
40a04f2657 Fix match single binding when in a let stmt 2020-03-09 16:59:24 +01:00
Vivek Ghaisas
ab6e709ee6 Improve error messages for {option,result}_map_unit_fn
Instead of saying "unit function", use the phrase the description
uses: "function that returns the unit type".

Fixes #5180.
2020-03-08 21:28:06 +00:00
Matthias Krüger
75a2300e27 redundant_pattern: take binding (ref, ref mut) into account in suggestion.
fixes #5271
2020-03-08 10:47:18 +01:00
Jacob Meyers
0f7f30711e add lint on File::read_to_string and File::read_to_end 2020-03-06 09:50:49 -05:00
flip1995
57393b5106
Rename macro_use_import -> macro_use_imports 2020-03-05 19:22:17 +01:00
bors
23d2b21297 Auto merge of #5230 - DevinR528:macro-use, r=flip1995
Macro use

---

changelog: This lint enforces Rust 2018 idiom of importing macro's directly without `#[macro_use]` fixes #5179 .
2020-03-05 17:30:52 +00:00
bors
329923edec Auto merge of #5257 - mlegner:cast_hex_fp, r=flip1995
Resolve false positives of unnecessary_cast for non-decimal integers

This PR resolves false positives of `unnecessary_cast` for hexadecimal integers to floats and adds a corresponding test case.

Fixes: #5220

changelog: none
2020-03-04 16:11:40 +00:00
Devin R
597e02dcdf warn on macro_use attr 2020-03-04 09:36:02 -05:00
bors
8c7b3ad3fa Auto merge of #5266 - sinkuu:questionmark, r=flip1995
Lint `if let Some` and early return in question_mark lint

Fixes #5260

changelog: lint `if let Some` and early return in `question_mark` lint
2020-03-04 13:30:08 +00:00
mlegner
73deb723dd
Included binary and octal cases. 2020-03-04 13:21:01 +01:00
mlegner
9ff4581cd3
Test for unnecessary_cast of hex int literal. 2020-03-04 13:21:00 +01:00
bors
36b65986af Auto merge of #5258 - ThibsG:UselessBindingInStruct638, r=flip1995
Add lint for .. use in fully binded struct

This PR adds the lint `match-wild-in-fully-binded-struct` to prevent the use of the `..` pattern when all fields of the struct are already binded.

Fixes: #638

changelog: Add [`rest_pat_in_fully_bound_structs`] lint to warn against the use of `..` in fully binded struct
2020-03-04 11:06:31 +00:00
bors
8dc3fde127 Auto merge of #5246 - JarredAllen:master, r=flip1995
Detect usage of custom floating-point abs implementation

Closes #5224

changelog: Enhance [`suboptimal_flops`] lint to detect manual implementations of the `abs` method
2020-03-04 10:53:03 +00:00
Shotaro Yamada
246709f89e run-rustfix 2020-03-04 17:37:01 +09:00
Shotaro Yamada
45f61ead2c Lint if let Some in question_mark lint 2020-03-04 17:24:12 +09:00
ThibsG
2aa14c9beb Add restrictive pat use in full binded struct 2020-03-04 09:11:07 +01:00
JarredAllen
c3e96d14ab Update test case answers to match cargo dev fmt 2020-03-03 19:23:04 -08:00
JarredAllen
fe342f3291 Ran cargo dev fmt 2020-03-03 18:06:59 -08:00
flip1995
a640696cdf
Rustup to rust-lang/rust#69506 2020-03-04 00:56:43 +01:00
JarredAllen
f8e949fa1c Recommended changes from flip1995 2020-03-03 15:52:53 -08:00
Yuki Okushi
46ee6b1840 Add regression test 2020-03-03 22:22:46 +09:00