]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #5788 - Leulz:shadow-unrelated-fix-rhs, r=flip1995
bors [Wed, 15 Jul 2020 19:09:21 +0000 (19:09 +0000)]
Auto merge of #5788 - Leulz:shadow-unrelated-fix-rhs, r=flip1995

Removing RHS snippet from SHADOW_UNRELATED message.

Fixes #5703

I am not sure if I reinvented the wheel here, but I could not really find a snippet function that did this truncation, so I created the function. Please tell me if there was a more obvious way to do this, I am new here. :smile:

changelog: Truncates multi-line RHS in shadow_unrelated message if it has more than 5 lines.

3 years agoAuto merge of #5802 - flip1995:rustup, r=flip1995
bors [Wed, 15 Jul 2020 18:17:25 +0000 (18:17 +0000)]
Auto merge of #5802 - flip1995:rustup, r=flip1995

Rustup

r? @ghost
changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Wed, 15 Jul 2020 18:15:57 +0000 (20:15 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRemoving snippet from SHADOW_UNRELATED message.
Leo Meira Vital [Mon, 13 Jul 2020 04:57:19 +0000 (01:57 -0300)]
Removing snippet from SHADOW_UNRELATED message.

3 years agoWithOptConstParam::dummy -> WithOptConstParam::unknown
Bastian Kauschke [Wed, 15 Jul 2020 08:55:41 +0000 (10:55 +0200)]
WithOptConstParam::dummy -> WithOptConstParam::unknown

3 years agoimprove naming
Bastian Kauschke [Wed, 15 Jul 2020 08:50:54 +0000 (10:50 +0200)]
improve naming

3 years agoconst_eval_resolve
Bastian Kauschke [Thu, 2 Jul 2020 21:56:17 +0000 (23:56 +0200)]
const_eval_resolve

3 years agoRemove lots of `Symbol::as_str()` calls.
Nicholas Nethercote [Wed, 8 Jul 2020 10:03:37 +0000 (20:03 +1000)]
Remove lots of `Symbol::as_str()` calls.

In various ways, such as changing functions to take a `Symbol` instead
of a `&str`.

3 years agoAuto merge of #5798 - mikerite:fix-2277-2, r=yaahc
bors [Tue, 14 Jul 2020 17:23:31 +0000 (17:23 +0000)]
Auto merge of #5798 - mikerite:fix-2277-2, r=yaahc

Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

changelog: none

3 years agoAuto merge of #5793 - warner:5783-nth-zero-next, r=flip1995
bors [Tue, 14 Jul 2020 16:58:23 +0000 (16:58 +0000)]
Auto merge of #5793 - warner:5783-nth-zero-next, r=flip1995

improve advice in iter_nth_zero

fixes #5783

*Please keep the line below*
changelog:  For iter_nth_zero, the "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead.

3 years agoAuto merge of #5737 - Uriopass:unit-for-ord, r=flip1995
bors [Tue, 14 Jul 2020 16:32:25 +0000 (16:32 +0000)]
Auto merge of #5737 - Uriopass:unit-for-ord, r=flip1995

Reprise: new lint: Unintentional return of unit from closures expecting Ord

This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

Reprise of #5348 where I addressed all the comments there

changelog: add lint [`unit_return_expecting_ord`]

3 years agoformatting nits
Brian Warner [Tue, 14 Jul 2020 16:20:19 +0000 (09:20 -0700)]
formatting nits

3 years agonew lint: Returning unit from closures expecting Ord
Matthias Krüger [Mon, 30 Mar 2020 09:02:14 +0000 (11:02 +0200)]
new lint: Returning unit from closures expecting Ord

This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

reprise: rebase, update and address all concerns

3 years agoMerge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
flip1995 [Tue, 14 Jul 2020 12:59:59 +0000 (14:59 +0200)]
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup

3 years agoAuto merge of #5732 - bjorn3:patch-1, r=flip1995
bors [Tue, 14 Jul 2020 09:39:01 +0000 (09:39 +0000)]
Auto merge of #5732 - bjorn3:patch-1, r=flip1995

Rename collapsable_if fix suggestion to "collapse nested if block"

The name "try" is confusing when shown as quick fix by rust-analyzer

changelog: Rename `collapsable_if` fix suggestion to "collapse nested if block"

3 years agoAuto merge of #5773 - giraffate:repeat_once, r=flip1995
bors [Tue, 14 Jul 2020 09:13:58 +0000 (09:13 +0000)]
Auto merge of #5773 - giraffate:repeat_once, r=flip1995

Add a lint for `.repeat(1)`

changelog: New lint `repeat_once`

fix #3028.

3 years agoAdd test for `needless_range_loop` issue
Michael Wright [Tue, 14 Jul 2020 06:18:15 +0000 (08:18 +0200)]
Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

3 years agoUse `.is_some()` not `Some(_)`
Takayuki Nakata [Mon, 13 Jul 2020 23:08:13 +0000 (08:08 +0900)]
Use `.is_some()` not `Some(_)`

3 years agoimprove advice in iter_nth_zero
Brian Warner [Mon, 13 Jul 2020 17:33:25 +0000 (10:33 -0700)]
improve advice in iter_nth_zero

The "use .next()" replacement advice is on the last line of the code snippet,
where it is vulnerable to truncation. Display that advice at the beginning
instead.

closes #5783

3 years agoRename collapsable_if fix suggestion to "collapse nested if block"
bjorn3 [Fri, 19 Jun 2020 09:44:03 +0000 (11:44 +0200)]
Rename collapsable_if fix suggestion to "collapse nested if block"

The name "try" is confusing when shown as quick fix by rust-analyzer

3 years agoRefactoring to use `constant_context
Takayuki Nakata [Mon, 13 Jul 2020 15:11:10 +0000 (00:11 +0900)]
Refactoring to use `constant_context

Use `constant_context`, `.is_str()` and `builtin_index()` to simplify.

3 years agoAuto merge of #5792 - flip1995:rollup-torc1we, r=flip1995
bors [Mon, 13 Jul 2020 14:21:20 +0000 (14:21 +0000)]
Auto merge of #5792 - flip1995:rollup-torc1we, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5443 (Some accuracy lints for floating point operations)
 - #5752 (Move range_minus_one to pedantic)
 - #5756 (unnecessary_sort_by: avoid linting if key borrows)
 - #5784 (Fix out of bounds access by checking length equality BEFORE accessing by index.)
 - #5786 (fix phrase in new_lint issue template)

Failed merges:

r? @ghost

changelog: rollup

3 years agoRollup merge of #5786 - matthiaskrgr:new_lint_issue_templ, r=phansch
Philipp Krones [Mon, 13 Jul 2020 13:59:46 +0000 (15:59 +0200)]
Rollup merge of #5786 - matthiaskrgr:new_lint_issue_templ, r=phansch

fix phrase in new_lint issue template

changelog: none

3 years agoRollup merge of #5784 - matthiaskrgr:ice_5780, r=phansch
Philipp Krones [Mon, 13 Jul 2020 13:59:45 +0000 (15:59 +0200)]
Rollup merge of #5784 - matthiaskrgr:ice_5780, r=phansch

Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes #5780

changelog: fix out of bounds access in unnested_or_patterns lint.

Edit: I did not bother reducing a testcase from `librustc_typeck` crate but I can confirm that with the change the crash no longer occurs.

3 years agoRollup merge of #5756 - ebroto:5754_sort_by, r=flip1995
Philipp Krones [Mon, 13 Jul 2020 13:59:44 +0000 (15:59 +0200)]
Rollup merge of #5756 - ebroto:5754_sort_by, r=flip1995

unnecessary_sort_by: avoid linting if key borrows

changelog: Avoid linting if key borrows in [`unnecessary_sort_by`]

Fixes #5754
Closes #2313

3 years agoRollup merge of #5752 - chrisduerr:pedantic_ranges, r=flip1995
Philipp Krones [Mon, 13 Jul 2020 13:59:42 +0000 (15:59 +0200)]
Rollup merge of #5752 - chrisduerr:pedantic_ranges, r=flip1995

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.

*Please keep the line below*
changelog: move [`range_minus_one`] to pedantic

3 years agoRollup merge of #5443 - thiagoarrais:issue-2040, r=flip1995
Philipp Krones [Mon, 13 Jul 2020 13:59:41 +0000 (15:59 +0200)]
Rollup merge of #5443 - thiagoarrais:issue-2040, r=flip1995

Some accuracy lints for floating point operations

This will add some lints for accuracy on floating point operations suggested by @clarfon in #2040 (fixes #2040).

These are the remaining lints:

- [x] x.powi(2) => x * x
- [x] x.logN() / y.logN() => x.logbase(y)
- [x] x.logbase(E) => x.log()
- [x] x.logbase(10) => x.log10()
- [x] x.logbase(2) => x.log2().
- [x] x * PI / 180 => x.to_radians()
- [x] x * 180 / PI => x.to_degrees()
- [x] (x + 1).log() => x.log_1p()
- [x] sqrt(x * x + y * y) => x.hypot(y)

changelog: Included some accuracy lints for floating point operations

3 years agoAuto merge of #5790 - flip1995:rustup, r=flip1995
bors [Mon, 13 Jul 2020 13:53:11 +0000 (13:53 +0000)]
Auto merge of #5790 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

changelog: none

3 years agofix phrase in new_lint issue template
Matthias Krüger [Sat, 11 Jul 2020 21:42:56 +0000 (23:42 +0200)]
fix phrase in new_lint issue template

3 years agoRollup merge of #72920 - oli-obk:const_transmute, r=RalfJung
Manish Goregaokar [Sat, 11 Jul 2020 15:53:06 +0000 (08:53 -0700)]
Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung

Stabilize `transmute` in constants and statics but not const fn

cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)

Previous attempt: #64011

r? @RalfJung

cc @rust-lang/wg-const-eval

3 years agoFix out of bounds access by checking length equality BEFORE accessing by index.
Matthias Krüger [Sat, 11 Jul 2020 10:28:21 +0000 (12:28 +0200)]
Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes #5780

3 years agoStabilize `transmute` in constants and statics but not const fn
Oliver Scherer [Fri, 30 Aug 2019 00:01:04 +0000 (02:01 +0200)]
Stabilize `transmute` in constants and statics but not const fn

3 years agoAuto merge of #5769 - robojumper:match_like_matches_macro, r=phansch
bors [Fri, 10 Jul 2020 18:10:08 +0000 (18:10 +0000)]
Auto merge of #5769 - robojumper:match_like_matches_macro, r=phansch

new lint: match_like_matches_macro

Suggests using the `matches!` macro from `std` where appropriate.

`redundant_pattern_matching` has been moved into the `matches` pass to allow suppressing the suggestion where `is_some` and friends are a better replacement.

changelog: new lint: `match_like_matches_macro`

3 years agoFix tests a bit more
Christian Duerr [Fri, 10 Jul 2020 15:53:01 +0000 (17:53 +0200)]
Fix tests a bit more

3 years agoFix test failures
Christian Duerr [Fri, 10 Jul 2020 15:23:03 +0000 (17:23 +0200)]
Fix test failures

3 years agoFix typo
Takayuki Nakata [Fri, 10 Jul 2020 14:53:15 +0000 (23:53 +0900)]
Fix typo

3 years agoRun update_lints
Christian Duerr [Fri, 3 Jul 2020 19:09:32 +0000 (21:09 +0200)]
Run update_lints

3 years agoMove range_minus_one to pedantic
Christian Duerr [Fri, 26 Jun 2020 15:03:10 +0000 (17:03 +0200)]
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.

3 years agoAvoid "whitelist"
Tamir Duberstein [Tue, 7 Jul 2020 15:12:44 +0000 (11:12 -0400)]
Avoid "whitelist"

Other terms are more inclusive and precise.

3 years agoAuto merge of #5781 - giraffate:fix_a_broken_link, r=phansch
bors [Thu, 9 Jul 2020 18:21:44 +0000 (18:21 +0000)]
Auto merge of #5781 - giraffate:fix_a_broken_link, r=phansch

Fix a broken link in CONTRIBUTING.md

changelog: none

3 years agoFix a broken link in CONTRIBUTING.md
Takayuki Nakata [Thu, 9 Jul 2020 13:07:15 +0000 (22:07 +0900)]
Fix a broken link in CONTRIBUTING.md

3 years agoAuto merge of #5771 - montrivo:bugfix/single-match-else, r=matthiaskrgr
bors [Thu, 9 Jul 2020 12:03:14 +0000 (12:03 +0000)]
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

3 years agosingle_match_else - single expr/stmt else block corner case
Tim Nielens [Mon, 6 Jul 2020 22:35:51 +0000 (00:35 +0200)]
single_match_else - single expr/stmt else block corner case

3 years agounnecessary_sort_by: avoid linting if key borrows
Eduardo Broto [Tue, 30 Jun 2020 19:48:34 +0000 (21:48 +0200)]
unnecessary_sort_by: avoid linting if key borrows

3 years agomake match_like_matches_macro only apply to matches with a wildcard
robojumper [Wed, 8 Jul 2020 16:04:51 +0000 (18:04 +0200)]
make match_like_matches_macro only apply to matches with a wildcard

3 years agoAuto merge of #5776 - flip1995:rustup, r=flip1995
bors [Wed, 8 Jul 2020 15:56:23 +0000 (15:56 +0000)]
Auto merge of #5776 - flip1995:rustup, r=flip1995

Rustup

changelog: none

r? @ghost

3 years agoAdd a lint for `.repeat(1)`
Takayuki Nakata [Sat, 4 Jul 2020 13:50:03 +0000 (22:50 +0900)]
Add a lint for `.repeat(1)`

fix #3028.

4 years agoAuto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearth
bors [Tue, 7 Jul 2020 00:56:44 +0000 (00:56 +0000)]
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

4 years agoRollup merge of #73870 - sexxi-goose:projection-ty, r=nikomatsakis
Manish Goregaokar [Tue, 7 Jul 2020 00:45:20 +0000 (17:45 -0700)]
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

4 years agoAuto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercote
bors [Mon, 6 Jul 2020 20:44:16 +0000 (20:44 +0000)]
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

4 years agoIncludes TODO for constants equivalent to π/180
Thiago Arrais [Mon, 6 Jul 2020 16:14:52 +0000 (13:14 -0300)]
Includes TODO for constants equivalent to π/180

4 years agoReclassify powi(2) lint under suboptimal_flops
Thiago Arrais [Mon, 22 Jun 2020 17:16:27 +0000 (14:16 -0300)]
Reclassify powi(2) lint under suboptimal_flops

4 years agoIncludes TODO comment for hypot lint
Thiago Arrais [Wed, 17 Jun 2020 16:43:11 +0000 (13:43 -0300)]
Includes TODO comment for hypot lint

4 years agoPlace radian lints under suboptimal_flops
Thiago Arrais [Mon, 15 Jun 2020 16:59:44 +0000 (13:59 -0300)]
Place radian lints under suboptimal_flops

4 years agoBetter copy for lint message
Thiago Arrais [Mon, 15 Jun 2020 16:55:12 +0000 (13:55 -0300)]
Better copy for lint message

Since x.log(y) is actually implemented as x.ln() / y.ln()

4 years agoLint for to_radians and to_degrees
Thiago Arrais [Wed, 10 Jun 2020 16:52:00 +0000 (13:52 -0300)]
Lint for to_radians and to_degrees

4 years agofix match_like_matches_macro in clippy
robojumper [Sun, 5 Jul 2020 20:11:19 +0000 (22:11 +0200)]
fix match_like_matches_macro in clippy

4 years agoLint x.log(b) / y.log(b) => x.log(y)
Thiago Arrais [Mon, 1 Jun 2020 21:32:52 +0000 (18:32 -0300)]
Lint x.log(b) / y.log(b) => x.log(y)

4 years agonew lint: match_like_matches_macro
robojumper [Sun, 5 Jul 2020 20:10:59 +0000 (22:10 +0200)]
new lint: match_like_matches_macro

4 years agoLint (x * x + y * y).sqrt() => x.hypot(y)
Thiago Arrais [Mon, 25 May 2020 16:54:39 +0000 (13:54 -0300)]
Lint (x * x + y * y).sqrt() => x.hypot(y)

4 years agoLint for x.powi(2) => x * x
Thiago Arrais [Fri, 3 Apr 2020 16:58:52 +0000 (13:58 -0300)]
Lint for x.powi(2) => x * x

4 years agoAuto merge of #5301 - JarredAllen:option_if_let_else, r=flip1995
bors [Mon, 6 Jul 2020 15:56:52 +0000 (15:56 +0000)]
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`]

4 years agoShrink ParamEnv to 16 bytes
Mark Rousskov [Fri, 3 Jul 2020 00:52:40 +0000 (20:52 -0400)]
Shrink ParamEnv to 16 bytes

4 years agoFixed compile errors
JarredAllen [Sat, 4 Jul 2020 03:28:40 +0000 (20:28 -0700)]
Fixed compile errors

4 years agoFormatted updates to lints
JarredAllen [Wed, 1 Jul 2020 18:41:11 +0000 (11:41 -0700)]
Formatted updates to lints

4 years agoUpdate compile-test to follow new lint
JarredAllen [Sat, 27 Jun 2020 23:55:47 +0000 (16:55 -0700)]
Update compile-test to follow new lint

4 years agoClean existing lint code to match new lint
JarredAllen [Thu, 25 Jun 2020 18:58:47 +0000 (11:58 -0700)]
Clean existing lint code to match new lint

4 years agoFix compile error from library change
JarredAllen [Thu, 25 Jun 2020 18:39:58 +0000 (11:39 -0700)]
Fix compile error from library change

4 years agoLast few tweaks
JarredAllen [Fri, 12 Jun 2020 15:32:38 +0000 (08:32 -0700)]
Last few tweaks

4 years agoUsed clippy to clean itself
JarredAllen [Sun, 31 May 2020 22:37:21 +0000 (15:37 -0700)]
Used clippy to clean itself

4 years agoDon't lint if contains a macro
JarredAllen [Sun, 31 May 2020 22:34:10 +0000 (15:34 -0700)]
Don't lint if contains a macro

4 years agoRefactoring pt. 2
JarredAllen [Tue, 12 May 2020 00:52:47 +0000 (17:52 -0700)]
Refactoring pt. 2

4 years agoRefactoring
JarredAllen [Sun, 10 May 2020 03:44:56 +0000 (20:44 -0700)]
Refactoring

4 years agoHandle ref, mut, &, and &mut on the option
JarredAllen [Sun, 10 May 2020 03:20:57 +0000 (20:20 -0700)]
Handle ref, mut, &, and &mut on the option

4 years agoProperly parenthesize to avoid operator precedence errors
JarredAllen [Sat, 25 Apr 2020 16:08:23 +0000 (09:08 -0700)]
Properly parenthesize to avoid operator precedence errors

4 years agoStop linting on macros and correctly use braces for constructs
JarredAllen [Sat, 25 Apr 2020 15:32:33 +0000 (08:32 -0700)]
Stop linting on macros and correctly use braces for  constructs

4 years agoLint for if let Some(x) = ... instead of Option::map_or
JarredAllen [Thu, 5 Mar 2020 18:35:05 +0000 (10:35 -0800)]
Lint for if let Some(x) = ... instead of Option::map_or

4 years agoAuto merge of #4841 - phaylon:pattern-type-mismatch, r=flip1995
bors [Fri, 3 Jul 2020 16:41:26 +0000 (16:41 +0000)]
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.)

4 years agofmt fix
Robert Sedlacek [Fri, 3 Jul 2020 16:23:36 +0000 (18:23 +0200)]
fmt fix

4 years agoLateContext has only one lifetime parameter now
Robert Sedlacek [Fri, 3 Jul 2020 16:20:19 +0000 (18:20 +0200)]
LateContext has only one lifetime parameter now

4 years agoAuto merge of #5761 - ThibsG:TypeRepetitionThreshold, r=flip1995
bors [Fri, 3 Jul 2020 16:17:41 +0000 (16:17 +0000)]
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

4 years agoExpanded lint documentation
Robert Sedlacek [Wed, 1 Jul 2020 13:49:46 +0000 (15:49 +0200)]
Expanded lint documentation

4 years agoCatching up with rustc changes
Robert Sedlacek [Wed, 1 Jul 2020 13:49:06 +0000 (15:49 +0200)]
Catching up with rustc changes

4 years agoFix rebase fallout
flip1995 [Mon, 8 Jun 2020 13:10:57 +0000 (15:10 +0200)]
Fix rebase fallout

4 years agoAdjusted expected STDERR
Robert Sedlacek [Mon, 10 Feb 2020 21:19:19 +0000 (22:19 +0100)]
Adjusted expected STDERR

4 years agospan_help_and_lint -> span_lint_and_help
Robert Sedlacek [Sun, 9 Feb 2020 16:57:35 +0000 (17:57 +0100)]
span_help_and_lint -> span_lint_and_help

4 years agoAdded restriction lint: pattern-type-mismatch
Robert Sedlacek [Mon, 4 Nov 2019 18:39:03 +0000 (19:39 +0100)]
Added restriction lint: pattern-type-mismatch

4 years agoDon't lint for predicates generated in macros
ThibsG [Fri, 3 Jul 2020 09:48:28 +0000 (11:48 +0200)]
Don't lint for predicates generated in macros

4 years agoTake generic args into account for bounded type
ThibsG [Fri, 3 Jul 2020 08:29:14 +0000 (10:29 +0200)]
Take generic args into account for bounded type

4 years agoAdd configurable threshold for `type_repetition_in_bounds` lint
ThibsG [Sun, 28 Jun 2020 10:14:04 +0000 (12:14 +0200)]
Add configurable threshold for `type_repetition_in_bounds` lint

4 years agoAuto merge of #5763 - flip1995:rustup, r=Manishearth
bors [Fri, 3 Jul 2020 14:48:59 +0000 (14:48 +0000)]
Auto merge of #5763 - flip1995:rustup, r=Manishearth

Rustup

changelog: none

4 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Fri, 3 Jul 2020 10:50:41 +0000 (12:50 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

4 years agoUse 'tcx for references to AccessLevels wherever possible.
Eduard-Mihai Burtescu [Thu, 25 Jun 2020 20:41:36 +0000 (23:41 +0300)]
Use 'tcx for references to AccessLevels wherever possible.

4 years agorustc_lint: avoid using TypeckTables::empty for LateContext.
Eduard-Mihai Burtescu [Fri, 26 Jun 2020 02:55:23 +0000 (05:55 +0300)]
rustc_lint: avoid using TypeckTables::empty for LateContext.

4 years agoAuto merge of #5760 - phansch:deprecate-regex-macro, r=Manishearth
bors [Wed, 1 Jul 2020 14:50:53 +0000 (14:50 +0000)]
Auto merge of #5760 - phansch:deprecate-regex-macro, r=Manishearth

Deprecate regex_macro lint

Closes #2586

changelog: Deprecate regex_macro lint

4 years agoDeprecate regex_macro lint
Philipp Hansch [Wed, 1 Jul 2020 10:36:36 +0000 (12:36 +0200)]
Deprecate regex_macro lint

4 years agoAuto merge of #5759 - mikerite:multiple_crate_versions_20200701, r=matthiaskrgr
bors [Wed, 1 Jul 2020 08:13:52 +0000 (08:13 +0000)]
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

4 years agoFix multiple_crate_versions error
Michael Wright [Wed, 1 Jul 2020 05:30:03 +0000 (07:30 +0200)]
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.

4 years agoAuto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995
bors [Tue, 30 Jun 2020 22:23:23 +0000 (22:23 +0000)]
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

4 years agoRequire `or_patterns` to suggest nesting them
Eduardo Broto [Tue, 30 Jun 2020 22:15:21 +0000 (00:15 +0200)]
Require `or_patterns` to suggest nesting them