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
bors
f44181e799
Auto merge of #5047 - flip1995:use_debug, r=phansch
...
Don't trigger use_debug lint in Debug impl
Fixes #5039
changelog: Don't trigger [`use_debug`] lint in Debug impl
2020-03-03 11:32:51 +00:00
bors
5d3e3e1a9e
Auto merge of #5250 - mlegner:unused_fp, r=flip1995
...
Whitelist unused attribute for use items.
This PR whitelists the `unused` attribute with `use` items and adds a corresponding test case.
Fixes : #5229
changelog: none
2020-03-03 11:16:55 +00:00
flip1995
a540b5ca2e
Update stderr
2020-03-03 10:48:08 +01:00
mlegner
8669be56c4
Whitelist unused attribute for use items.
2020-03-02 10:22:05 +01:00
JarredAllen
ee73972537
Changed test output to reflect cargo fmt
2020-02-29 19:11:38 -08:00
JarredAllen
bfa2691559
Run cargo dev fmt
2020-02-29 18:51:39 -08:00
JarredAllen
028cddb956
Finished checking for cases of absolute values
2020-02-29 13:46:59 -08:00
Matthias Krüger
1e29b36e4e
add test for #5238
2020-02-28 22:00:20 +01:00
JarredAllen
5a21661ce5
Some bugfixing
2020-02-28 12:40:13 -08:00
JarredAllen
ce0dc9b70e
Created floating point abs lint and test, but not yet run
2020-02-27 22:31:41 -08:00
Yuki Okushi
7c760e5f83
Rustup to rust-lang/rust#61812
2020-02-27 12:19:18 +09:00
Krishna Sai Veera Reddy
ff0d44e45a
Add imprecise_flops
lint
...
Add lint to detect floating point operations that can be computed more
accurately at the cost of performance. `cbrt`, `ln_1p` and `exp_m1`
library functions call their equivalent cmath implementations which is
slower but more accurate so moving checks for these under this new lint.
2020-02-23 22:36:15 -08:00
Krishna Sai Veera Reddy
e94a167508
Rename mul_add
test file and add general improvements
2020-02-23 22:20:34 -08:00
Krishna Sai Veera Reddy
4065ca9c8c
Move manual_mul_add
into suboptimal_flops
lint
2020-02-23 22:20:34 -08:00
Krishna Sai Veera Reddy
454e505c12
Run rust-fix on tests
2020-02-23 22:20:34 -08:00
Krishna Sai Veera Reddy
6dacb1aa67
Change lint name to suboptimal_flops
2020-02-23 22:20:34 -08:00
Krishna Sai Veera Reddy
bc03f465c3
Remove lint for logarithm division identity
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
fd2506bcbf
Add type suffixes to unsuffixed method receiver suggestions
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
de07c84903
Detect usage of (x + 1).ln()
and suggest x.ln_1p()
instead
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
a60ae5d31c
Split test cases into separate files
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
de79733924
Lint expressions of the form x.log(b) / y.log(b)
2020-02-23 22:20:33 -08:00
Krishna Veera Reddy
9520d3dfa4
Suggest usage of powi
method when applicable
2020-02-23 22:20:33 -08:00
Krishna Veera Reddy
1f4f357bf5
Consolidate the accuracy and efficiency lints
...
Merge the accuracy and efficiency lints into a single lint that
checks for improvements to accuracy, efficiency and readability
of floating-point expressions.
2020-02-23 22:20:33 -08:00
Krishna Veera Reddy
c636c6a55b
Add lints to detect inaccurate and inefficient FP operations
...
Add lints to detect floating point computations that are either
inaccurate or inefficient and suggest better alternatives.
2020-02-23 22:20:33 -08:00
Krishna Sai Veera Reddy
049079856b
Prevent missing_const_for_fn
on functions with const generic params
...
`const` functions cannot have const generic parameters so prevent the
`missing_const_for_fn` lint from firing in that case.
2020-02-21 19:56:44 -08:00
flip1995
4dd2252b17
Fix suggestion for weird formattings
2020-02-21 11:14:19 +01:00
flip1995
b67764d5cb
Add test for prelude import
2020-02-21 11:14:18 +01:00
flip1995
06a6189376
Move enum_glob_use lint into wildcard_imports pass
2020-02-21 11:14:17 +01:00
flip1995
8a572a540a
Add tests for wildcard_imports lint
2020-02-21 11:02:25 +01:00
bors
acfcbee4a2
Auto merge of #5202 - krishna-veerareddy:issue-5201-move-lossy-float-literal-restriction, r=flip1995
...
Move check for lossy whole-number floats out of `excessive_precision`
changelog: Add new lint `lossy_float_literal` to detect lossy whole number float literals and move it out of `excessive_precision` again.
Fixes #5201
2020-02-21 09:43:55 +00:00
Yuki Okushi
8abe4365f3
Use generator own DefId
2020-02-21 16:24:58 +09:00
Krishna Sai Veera Reddy
219c94d028
Separate out lint to check lossy whole number float literals
2020-02-20 22:33:36 -08:00
Matthias Krüger
4f85bc2fe9
rustup https://github.com/rust-lang/rust/pull/69325 , update test stderr
2020-02-20 23:54:10 +01:00
flip1995
fb989d3215
Remove remaining license header in test file
2020-02-20 12:06:45 +01:00
Krishna Sai Veera Reddy
533422fcce
Add LOG2_10
and LOG10_2
to approx_const
lint
2020-02-18 08:05:00 -08:00
daxpedda
0ee393cf01
Add tests and improve checks.
2020-02-17 14:43:38 +01:00
Krishna Sai Veera Reddy
552452873c
Add tests for lossy whole number float literals
2020-02-17 00:05:50 -08:00
Yuki Okushi
09165ff576
Don't lint single_component_path_imports
in macros
2020-02-17 11:13:42 +09:00
Yuki Okushi
f77158bc14
Fix false positive in zero_prefixed_literal
2020-02-13 14:39:29 +09:00
Krishna Sai Veera Reddy
fcc3e7238f
Remove unnecessary imports from tests
2020-02-11 06:20:47 -08:00
Krishna Sai Veera Reddy
b48b221f80
Use PATH
environment variable for testing
...
The tests were failing on windows because the `HOME` env variable
doesn't exist on it so using the `PATH` variable to test instead.
2020-02-09 15:35:51 -08:00
Krishna Sai Veera Reddy
a3a1587a1c
Allow option-env-unwrap
within external macros
2020-02-09 10:58:08 -08:00
Krishna Sai Veera Reddy
0e5ba2f0e7
Account for expect
being used to unwrap Option
2020-02-09 08:54:23 -08:00
Krishna Sai Veera Reddy
be1bc571c3
Add option-env-unwrap
lint
2020-02-08 16:44:35 -08:00
Lzu Tao
9a12baad35
Update CARGO_TARGET_DIR
2020-02-07 14:41:04 +07:00
Lzu Tao
c6a4beaf56
Rustup https://github.com/rust-lang/rust/pull/67359
2020-02-07 10:40:09 +07:00
bors
b5e6d6db41
Auto merge of #5134 - flip1995:snippet_block, r=phansch
...
Make it possible to correctly indent snippet_block snippets
This adds a `indent_relative_to` arg to the `{snippet,expr}_block` functions. This makes it possible to keep the correct indentation of block like suggestions.
In addition, this makes the `trim_multiline` function private and adds a `indent_of` function, to get the indentation of the first line of a span.
The suggestion of `needless_continue` cannot be made auto applicable, since it would be also necessary to remove code following the linted expression. (Well, maybe it is possible, but I don't know how to do it. Expanding the suggestion span to the last expression, that should be removed didn't work)
changelog: Improve suggestions, when blocks of code are involved
2020-02-06 21:41:50 +00:00
flip1995
9897927504
Rustup to rust-lang/rust#68788
2020-02-06 20:33:39 +01:00
flip1995
4068ff4d8a
Improve help message in needless_continue
2020-02-06 19:15:01 +01:00
flip1995
c7979d3515
Fix rebase fallout
2020-02-06 19:15:01 +01:00
flip1995
7363728d18
Update remaining test files
2020-02-06 19:15:01 +01:00
flip1995
f1a72e992d
Update needless_continue stderr
2020-02-06 19:13:46 +01:00
flip1995
10cd1662c1
Update block_in_if_condition test files
2020-02-06 19:13:46 +01:00
bors
75e983a518
Auto merge of #5125 - Areredify:too_many_bools, r=flip1995
...
Port mitsuhiko's excessive bools lints
Closes #4 .
changelog: add `struct_excessive_bools` and `fn_params_excessive_bools` lints.
I moved is_trait_impl_item check because at first I implemented it as a late pass for some reason but then I realized it's actually an early lint. But it's a useful function to have, should I move it into a separate pr?
2020-02-06 14:47:14 +00:00
bors
a3135ba131
Auto merge of #5132 - JohnTitor:fix-fp-in-unwrap-lint, r=flip1995
...
Do not lint `unnecessary_unwrap` in external macros
Fixes #5131
I think we shouldn't lint `{panicking, unnecessary}_unwrap` in macros, not just `assert!`.
changelog: Fix false positive in `unnecessary_unwrap`
2020-02-06 14:17:35 +00:00
Areredify
338fb7a3e9
add excessive bools lints
2020-02-05 20:54:58 +03:00
ThibsG
53094de08e
Merge fixes
2020-02-04 22:53:24 +01:00
ThibsG
b29aacfec8
Add wild and struct handling
2020-02-04 22:53:24 +01:00
ThibsG
6afd7ea147
Use span_lint_and_sugg + move infaillible lint
...
- moving infaillible lint to prevent collisions
2020-02-04 22:49:08 +01:00
Yuki Okushi
19ce66c1c1
Re-cover use of unnecessary unwraps in macros
2020-02-05 05:38:26 +09:00
ThibsG
3445d41f07
Add new lint: match with a single binding statement
...
- Lint name: MATCH_SINGLE_BINDING
2020-02-04 01:06:16 +01:00
Yuki Okushi
514b1bc2af
Do not lint unnecessary_unwrap
in macros
2020-02-04 04:01:42 +09:00
Yuki Okushi
49934e70a2
Remove unnecessary comment
2020-02-04 01:29:11 +09:00
Yuki Okushi
7c5785ca2b
Split up indexing_slicing
ui test
2020-02-03 15:09:17 +09:00
Yuki Okushi
fa32b41365
Split up drop_forget_ref
ui test
2020-02-01 20:28:27 +09:00
Matthias Krüger
187983e991
update test stderr
2020-01-31 20:21:10 +01:00
flip1995
006f07f090
Add test for await
in debug_assert!(..)
2020-01-31 10:57:51 +01:00
bors
bbef531518
Auto merge of #5108 - JohnTitor:split-up-0130, r=flip1995
...
Split up `match` ui test
Part of #2038
Also, this decreases the line length limit to 220.
changelog: none
2020-01-30 21:06:47 +00:00
bors
668bc485da
Auto merge of #5101 - Areredify:let_underscore_lock, r=flip1995
...
add `let_underscore_lock` lint
closes #1574
changelog: add `let_underscore_lock` lint
I am not entirely sure about my docs/messages wording here, improvements are welcome
2020-01-30 20:24:24 +00:00
Areredify
63ab7a5e8c
lint all guard types, not just lock functions
2020-01-30 18:46:22 +03:00
Mikhail Babenko
9b88a2b295
decouple 'let_underscore' tests
2020-01-30 16:51:23 +03:00
Mikhail Babenko
d1f8621711
add lint
2020-01-30 16:48:56 +03:00
Yuki Okushi
17489ef811
Split up match
ui test
2020-01-30 12:06:42 +09:00
Yuki Okushi
ed6a0cc8a1
Revive test in enum_clike_unportable_variant
2020-01-30 11:43:19 +09:00
xiongmao86
26b1d60f15
Add test and update reference.
2020-01-30 00:22:42 +08:00
Yuki Okushi
314f438ab4
Split up non_copy_const
ui test
2020-01-27 12:14:11 +09:00