Commit Graph

7890 Commits

Author SHA1 Message Date
flip1995
a640696cdf
Rustup to rust-lang/rust#69506 2020-03-04 00:56:43 +01:00
bors
9c93f04c90 Auto merge of #5262 - JohnTitor:rls, r=flip1995
Revive rls integration test

RLS updated their dependencies in rust-lang/rls#1646 so we can revive the integration test. I confirm it passed on my local.

changelog: none
2020-03-03 20:13:19 +00:00
Yuki Okushi
e633ea823c Revive rls integration test 2020-03-04 04:32:42 +09:00
bors
e4d688c10a Auto merge of #5261 - matthiaskrgr:qmark, r=flip1995
use question mark operator

changelog: none
2020-03-03 14:41:20 +00:00
Matthias Krüger
94867fbbb8 use question mark operator 2020-03-03 15:13:25 +01:00
bors
d74229b97d Auto merge of #5256 - JohnTitor:try-eval-usize, r=phansch
Use `try_eval_usize` over `eval_usize`

Fixes #5223

changelog: Fix ICE in evaluating usizes
2020-03-03 13:38:42 +00:00
Yuki Okushi
46ee6b1840 Add regression test 2020-03-03 22:22:46 +09:00
Yuki Okushi
3d44ad2e32 Use try_eval_usize over eval_usize 2020-03-03 21:40:24 +09:00
bors
b96c3ca811 Auto merge of #5259 - flip1995:lang_items, r=phansch
Use lang items instead of get_trait_def_id where possible

changelog: none
2020-03-03 11:46:21 +00: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
91042db2e8
Add path for display trait 2020-03-03 10:54:30 +01:00
flip1995
58cea334ec
Use lang items instead of get_trait_def_id where possible 2020-03-03 10:54:30 +01:00
flip1995
a540b5ca2e
Update stderr 2020-03-03 10:48:08 +01:00
flip1995
a628733ade
Don't lint debug formatting in debug impl 2020-03-03 10:48:08 +01:00
bors
a94b2c1f7d Auto merge of #5242 - matthiaskrgr:5238_test, r=flip1995
add test for #5238

changelog: none
2020-03-02 20:31:27 +00:00
bors
8b7f7e6672 Auto merge of #5254 - JohnTitor:sugg, r=flip1995
Rustup to rust-lang/rust#69469

changelog: none
2020-03-02 20:00:31 +00:00
Yuki Okushi
f1d0791c3a Rustup to rust-lang/rust#69469 2020-03-03 04:53:42 +09:00
mlegner
8669be56c4
Whitelist unused attribute for use items. 2020-03-02 10:22:05 +01:00
bors
0f4a3feccc Auto merge of #5247 - JohnTitor:syntax, r=flip1995
Some rustups

changelog: none
2020-03-01 15:41:00 +00:00
Yuki Okushi
cda7881869 Disable rls test for now 2020-03-02 00:17:14 +09:00
Yuki Okushi
78dc48ea50 Rustup to rust-lang/rust#69579 2020-03-01 23:32:49 +09:00
Yuki Okushi
4253aa7137 Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
Matthias Krüger
1e29b36e4e add test for #5238 2020-02-28 22:00:20 +01:00
bors
610bceae71 Auto merge of #5232 - JohnTitor:git2-0.12, r=phansch
Update git2 to 0.12

changelog: none
2020-02-27 09:52:56 +00:00
Yuki Okushi
43e760ce1d Update git2 to 0.12 2020-02-27 16:13:05 +09:00
bors
384593cd16 Auto merge of #5231 - JohnTitor:associated-type-defaults, r=phansch
Rustup to rust-lang/rust#61812

changelog: none
2020-02-27 06:40:31 +00:00
Yuki Okushi
7c760e5f83 Rustup to rust-lang/rust#61812 2020-02-27 12:19:18 +09:00
bors
2734e4e1f7 Auto merge of #4897 - krishna-veerareddy:issue-2040-accurate-float-functions, r=flip1995
Add lint to improve floating-point expressions

Looks for floating-point expressions that can be expressed using built-in methods to improve accuracy, performance and/or succinctness.

changelog: Add lint `floating_point_improvements`.

Fixes #4726
Partly addresses [#2040](https://github.com/rust-lang/rust-clippy/issues/2040)

Currently linted expressions:

| Expression | Suggestion |
|---------------------------------|------------|
| x.log(2.0) | x.log2() |
| x.log(10.0) | x.log10() |
| x.log(std::f32::consts::E) | x.ln() |
| (1 + x).ln() | x.ln_1p() |
| (2.0).powf(x) | x.exp2() |
| (std::f32::consts::E).powf(x) | x.exp() |
| x.powf(1/2) | x.sqrt() |
| x.powf(1/3) | x.cbrt() |
| x.powf(y), where y is whole | x.powi(y) |
| x.exp() - 1 | x.exp_m1() |
|x * y + z|x.mul_add(y, z)|
2020-02-24 08:33:03 +00:00
bors
c6ad3db8b5 Auto merge of #5222 - JohnTitor:dont-deploy, r=flip1995
Do not run deploy action on other repos

Usually, we don't have to run deploy action on other repos, let's ignore there.

changelog: none
2020-02-24 08:20:10 +00: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
bc706e3ba9 Fix powi suggestion and add general improvements 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
Yuki Okushi
ee91b5b2dd Do not run deploy action on other repos 2020-02-24 15:16:23 +09:00
bors
fc5d0cc583 Auto merge of #5221 - JohnTitor:rustup, r=phansch
Rustup to rust-lang/rust#69366

changelog: none
2020-02-24 05:58:17 +00:00
Yuki Okushi
036ec5b63d Rustup to rust-lang/rust#69366 2020-02-24 13:33:04 +09:00
bors
7e49122f20 Auto merge of #5216 - krishna-veerareddy:issue-5192-fp-const-fn, r=flip1995
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.

changelog: Fix false positive in `missing_const_for_fn`

Fixes #5192
2020-02-22 12:44:06 +00: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
bors
e342047068 Auto merge of #5029 - flip1995:wildcard_imports, r=phansch
New Lint: `wildcard imports`

Fixes #1228

### A few notes:
- I put this lint in the pedantic group, even though in the issue restriction was mentioned.
- Every fallout fix was automatically applied by `cargo fix` (This produced 3 `unused_imports` warnings) and are in commit 7e834c8. So reverting these changes wouldn't be a problem.

### A few ideas:
- A configuration to specify the amount of imported Items, where a `*` might be better.
- ~~A configuration to disable the lint for enums. Or just disable the lint for enums, since there is [`enum_glob_use`](https://rust-lang.github.io/rust-clippy/master/index.html#enum_glob_use)~~ I moved `enum_glob_use` into this lint in 12937f0

### A few quotes from the issue:
> Is there a way to ask the compiler about the modules or symbols that the current file is using?

Yes there is. I found it, once I was nearly finished implementing it myself. See 321d64a

> one hard optional feature would be to figure out what is currently used and add a suggestion to replace it with a full import list.

Yeah that was pretty hard, until I found the query for this. Queries are cool, but too hard to find.

> FWIW VS Code and Intellij IDEA both offer imports deglobbing which replace * with required imports.

And now, Clippy can do this too! 🎉

---

Your thoughts on the notes/ideas?

changelog: Add new lint [`wildcard imports`]. Add suggestion to [`enum_glob_use`]
2020-02-21 11:32:12 +00:00