Commit graph

8837 commits

Author SHA1 Message Date
Eduardo Broto
db1c946aaa unnecessary_sort_by: avoid linting if key borrows 2020-07-08 21:31:59 +02:00
bors
e12a316b01 Auto merge of #5776 - flip1995:rustup, r=flip1995
Rustup

changelog: none

r? @ghost
2020-07-08 15:56:23 +00:00
bors
c41fcad908 Auto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearth
Rollup of 14 pull requests

Successful merges:

 - #70563 ([rustdoc] Page hash handling)
 - #73856 (Edit librustc_lexer top-level docs)
 - #73870 (typeck: adding type information to projection)
 - #73953 (Audit hidden/short code suggestions)
 - #73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)])
 - #73969 (mir: mark mir construction temporaries as internal)
 - #73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr))
 - #74067 (rustdoc: Restore underline text decoration on hover for FQN in header)
 - #74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.)
 - #74078 (Always resolve type@primitive as a primitive, not a module)
 - #74089 (Add rust-analyzer to the build manifest)
 - #74090 (Remove unused RUSTC_DEBUG_ASSERTIONS)
 - #74102 (Fix const prop ICE)
 - #74112 (Expand abbreviation in core::ffi description)

Failed merges:

r? @ghost
2020-07-07 00:56:44 +00:00
Manish Goregaokar
245b006a2e Rollup merge of #73870 - sexxi-goose:projection-ty, r=nikomatsakis
typeck: adding type information to projection

This commit modifies the Place as follow:
* remove 'ty' from ProjectionKind
* add type information into to Projection
* replace 'ty' in Place with 'base_ty'
* introduce 'ty()' in `Place` to return the final type of the `Place`
* introduce `ty_before_projection()` in `Place` to return the type of
  a `Place` before i'th projection is applied

Closes https://github.com/rust-lang/project-rfc-2229/issues/5
2020-07-06 17:45:20 -07:00
bors
4705037374 Auto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercote
Shrink ParamEnv to 16 bytes

r? @nnethercote

x.py check passes but I haven't tried running perf or tests
2020-07-06 20:44:16 +00:00
bors
ac856922f8 Auto merge of #5301 - JarredAllen:option_if_let_else, r=flip1995
Suggest `Option::map_or`(_else) for `if let Some { y } else { x }`

Fixes #5203

There are two issues with this code that I have noticed:

- Use of `Option::map_or` causes it to always evaluate the code in the else block. If that block is computationally expensive or if it updates some state (such as getting the next value from an iterator), then this change would cause the code to behave differently. In either of those circumstances, it should suggest Option::map_or_else, which takes both cases as a closure and runs one. However, I don't know how to check if the expression would change some state, so I left the lint's applicability as MaybeIncorrect.

- There are lints which can trigger on specific sub-cases of this lint (`if_let_some_result`, `question_mark`, and `while_let_loop`) and suggest different changes (usually better ones because they're more specific). Is this acceptable for clippy to give multiple suggestions, or should I have the code check if those other lints trigger and then not trigger this lint if they do?

changelog: Add lint [`option_if_let_else`]
2020-07-06 15:56:52 +00:00
Mark Rousskov
3503247c11 Shrink ParamEnv to 16 bytes 2020-07-05 09:51:42 -04:00
JarredAllen
c8f700ea69 Fixed compile errors 2020-07-03 21:22:23 -07:00
JarredAllen
1c32263176 Formatted updates to lints 2020-07-03 16:51:44 -07:00
JarredAllen
6e2d55c8db Update compile-test to follow new lint 2020-07-03 16:51:44 -07:00
JarredAllen
6ce981225b Clean existing lint code to match new lint 2020-07-03 16:51:44 -07:00
JarredAllen
ccb999851a Fix compile error from library change 2020-07-03 16:50:45 -07:00
JarredAllen
93f0f5d37b Last few tweaks 2020-07-03 16:50:45 -07:00
JarredAllen
5150277a4f Used clippy to clean itself 2020-07-03 16:50:45 -07:00
JarredAllen
5e20475e47 Don't lint if contains a macro 2020-07-03 16:47:38 -07:00
JarredAllen
7c4de9d3de Refactoring pt. 2 2020-07-03 16:47:38 -07:00
JarredAllen
f73b455b99 Refactoring 2020-07-03 16:47:38 -07:00
JarredAllen
88c8afdddf Handle ref, mut, &, and &mut on the option 2020-07-03 16:47:38 -07:00
JarredAllen
b85796fe36 Properly parenthesize to avoid operator precedence errors 2020-07-03 16:47:38 -07:00
JarredAllen
82f8d4d6f1 Stop linting on macros and correctly use braces for constructs 2020-07-03 16:47:38 -07:00
JarredAllen
bf48a2d50d Lint for if let Some(x) = ... instead of Option::map_or 2020-07-03 16:47:38 -07:00
bors
57cdf2dc16 Auto merge of #4841 - phaylon:pattern-type-mismatch, r=flip1995
Added restriction lint: pattern-type-mismatch

changelog: Added a new restriction lint `pattern-type-mismatch`. This lint is especially helpful for beginners learning about the magic behind pattern matching. (This explanation might be worth to include in the next changelog.)
2020-07-03 16:41:26 +00:00
Robert Sedlacek
c0fd452840 fmt fix 2020-07-03 18:23:36 +02:00
Robert Sedlacek
aa4bee228f LateContext has only one lifetime parameter now 2020-07-03 18:20:19 +02:00
bors
fff8e72913 Auto merge of #5761 - ThibsG:TypeRepetitionThreshold, r=flip1995
Improvements for `type_repetition_in_bounds` lint

Some improvements for `type_repetition_in_bounds`:
- add a configurable threshold to trigger the lint (#4380). The lint won't trigger anymore if there are more bounds (strictly) than `conf.max_trait_bounds` on this type.
- take generic args into account over bounded type (#4323)
- don't lint for predicates generated in macros (#4326)

Fixes #4380,
Fixes #4323,
Fixes #4326,
Closes #3764

changelog: Fix multiple FPs in `type_repetition_in_bounds` and add a configuration option

Note: the #3764 has already been fixed but not closed
2020-07-03 16:17:41 +00:00
Robert Sedlacek
d617551a6a Expanded lint documentation 2020-07-03 18:12:29 +02:00
Robert Sedlacek
92ecc53691 Catching up with rustc changes 2020-07-03 18:12:29 +02:00
flip1995
6447507ab1 Fix rebase fallout 2020-07-03 18:12:29 +02:00
Robert Sedlacek
346ee968bb Adjusted expected STDERR 2020-07-03 18:12:29 +02:00
Robert Sedlacek
55877d7b4a span_help_and_lint -> span_lint_and_help 2020-07-03 18:12:29 +02:00
Robert Sedlacek
c3c402783f Added restriction lint: pattern-type-mismatch 2020-07-03 18:12:29 +02:00
ThibsG
2d5930a3da Don't lint for predicates generated in macros 2020-07-03 17:29:54 +02:00
ThibsG
d5a8f03a35 Take generic args into account for bounded type 2020-07-03 17:29:54 +02:00
ThibsG
754bfb1dc8 Add configurable threshold for type_repetition_in_bounds lint 2020-07-03 17:29:54 +02:00
bors
c493090a8a Auto merge of #5763 - flip1995:rustup, r=Manishearth
Rustup

changelog: none
2020-07-03 14:48:59 +00:00
flip1995
a7c58e66d4
Merge remote-tracking branch 'upstream/master' into rustup 2020-07-03 12:50:41 +02:00
Eduard-Mihai Burtescu
30c046ede4 Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
Eduard-Mihai Burtescu
590e07bbc2 rustc_lint: avoid using TypeckTables::empty for LateContext. 2020-07-02 16:51:04 +03:00
bors
52cc5fce1e Auto merge of #5760 - phansch:deprecate-regex-macro, r=Manishearth
Deprecate regex_macro lint

Closes #2586

changelog: Deprecate regex_macro lint
2020-07-01 14:50:53 +00:00
Philipp Hansch
d347d0cf59
Deprecate regex_macro lint 2020-07-01 13:05:41 +02:00
bors
0860375664 Auto merge of #5759 - mikerite:multiple_crate_versions_20200701, r=matthiaskrgr
Fix multiple_crate_versions error

Fix the versions of packages in the multiple_crate_versions ui test by
checking in the Cargo.lock for the test package. `ansi_term 0.11`
depends on `winapi ^0.3.4`. This means means that the expected stderr for
this test would have to be updated whenever `winapi 0.3` is updated
otherwise.

changelog: none
2020-07-01 08:13:52 +00:00
Michael Wright
5b9c2ff9cc Fix multiple_crate_versions error
Fix the versions of packages in the multiple_crate_versions ui test by
checking in the Cargo.lock for the test package. `ansi_term 0.11`
depends on `winapi ^0.3.4`. This means means that the expected stderr for
this test would have to be updated whenever `winapi 0.3` is updated
otherwise.
2020-07-01 07:35:18 +02:00
bors
36b7983580 Auto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995
Require `or_patterns` to suggest nesting them

changelog: Require `#![feature(or_patterns)]` to trigger [`unnested_or_patterns`]

Fixes #5704
2020-06-30 22:23:23 +00:00
Eduardo Broto
bff6c435ef Require or_patterns to suggest nesting them 2020-07-01 00:15:21 +02:00
bors
d05d6abf89 Auto merge of #5750 - ebroto:blanket_clippy_restriction_lints, r=Manishearth,flip1995,phansch,oli-obk
Lint enabling the whole restriction group

I've added it to the `correctness` category, but I may be missing some valid use cases. In that case it could be changed to `pedantic`.

changelog: Add [`blanket_clippy_restriction_lints`] to check against enabling the whole restriction group.
2020-06-30 21:55:46 +00:00
Eduardo Broto
c5d8f530e0 Move blanket_clippy_restriction_lints to "style" 2020-06-30 21:56:19 +02:00
Eduardo Broto
814349f941 Lint enabling the whole restriction group 2020-06-30 21:56:19 +02:00
bors
ccf7cb3764 Auto merge of #5751 - flip1995:rustup, r=Manishearth,flip1995
Rustup

cc https://github.com/rust-lang/rust/pull/73743

r? @Manishearth

changelog: none
2020-06-30 14:20:09 +00:00
flip1995
ab649c920e
Disable chrono integration test 2020-06-30 16:19:42 +02:00
flip1995
1e861a2663
Merge remote-tracking branch 'upstream/master' into rustup2 2020-06-30 15:40:22 +02:00