Commit Graph

8842 Commits

Author SHA1 Message Date
Christian Duerr ba2a85dadc Run update_lints 2020-07-10 15:20:00 +02:00
Christian Duerr 298a1fa3bd Move range_minus_one to pedantic
This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see #3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.
2020-07-10 15:20:00 +02:00
bors be88122039 Auto merge of #5781 - giraffate:fix_a_broken_link, r=phansch
Fix a broken link in CONTRIBUTING.md

changelog: none
2020-07-09 18:21:44 +00:00
Takayuki Nakata c79c6888a5 Fix a broken link in CONTRIBUTING.md 2020-07-09 22:07:15 +09:00
bors 45eea9a822 Auto merge of #5771 - montrivo:bugfix/single-match-else, r=matthiaskrgr
single_match_else - single expr/stmt else block corner case

One approach to fix #3489.
See discussion in the issue.

changelog: single_match_else - single expr/stmt else block corner case fix
2020-07-09 12:03:14 +00:00
Tim Nielens dac19e3afc single_match_else - single expr/stmt else block corner case 2020-07-09 12:04:27 +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