]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUpdate clippy_lints/src/doc.rs
Manish Goregaokar [Tue, 28 Sep 2021 16:37:11 +0000 (09:37 -0700)]
Update clippy_lints/src/doc.rs

Co-authored-by: Cameron Steffen <cam.steffen94@gmail.com>
2 years agoMake doc_unsafe lint on unsafe traits as well
Manish Goregaokar [Tue, 28 Sep 2021 15:33:58 +0000 (08:33 -0700)]
Make doc_unsafe lint on unsafe traits as well

2 years agofmt
Manish Goregaokar [Tue, 28 Sep 2021 05:33:45 +0000 (22:33 -0700)]
fmt

2 years agoAdd renamed lint
Manish Goregaokar [Tue, 28 Sep 2021 05:26:14 +0000 (22:26 -0700)]
Add renamed lint

2 years agoUse a single if_chain
Manish Goregaokar [Tue, 28 Sep 2021 05:09:23 +0000 (22:09 -0700)]
Use a single if_chain

2 years agoAdjusting changelog
Andrew Pollack [Sat, 25 Sep 2021 15:39:00 +0000 (08:39 -0700)]
Adjusting changelog

2 years agoRemoved value from changelog to get pass
Andrew Pollack [Tue, 21 Sep 2021 00:34:32 +0000 (17:34 -0700)]
Removed value from changelog to get pass

2 years agoAdding new linting
Andrew Pollack [Mon, 30 Aug 2021 01:49:09 +0000 (18:49 -0700)]
Adding new  linting

2 years agoAuto merge of #7664 - matthiaskrgr:bump_to_2021, r=flip1995
bors [Mon, 27 Sep 2021 09:14:10 +0000 (09:14 +0000)]
Auto merge of #7664 - matthiaskrgr:bump_to_2021, r=flip1995

bump clippy crates to edition 2021

Also helps with dogfooding edition 2021 a bit. :)
Tests passed locally.

---

changelog: bump edition from 2018 to 2021

2 years agoAuto merge of #7692 - workingjubilee:float-cmp-not-wrong, r=giraffate
bors [Mon, 27 Sep 2021 09:00:31 +0000 (09:00 +0000)]
Auto merge of #7692 - workingjubilee:float-cmp-not-wrong, r=giraffate

Demote float_cmp to pedantic

See this issue: https://github.com/rust-lang/rust-clippy/issues/7666

This is one of the most frequently suppressed lints. It is deny-by-default. It is not actually clearly wrong, as there are many instances where direct float comparison is actually desirable. It is only after operating on floats that they may lose precision, and that depends greatly on the operation. As most correctness lints have a much higher standard of error, being based on hard and fast binary logic, this should not be amongst them.

A linter is not a substitute for observing the math carefully and running tests, and doing the desirable thing is even more likely to lead one to want exact comparisons.

changelog: Demote [`float_cmp`] from correctness to pedantic lints

2 years agoAuto merge of #7722 - dtolnay-contrib:float, r=giraffate
bors [Mon, 27 Sep 2021 00:49:08 +0000 (00:49 +0000)]
Auto merge of #7722 - dtolnay-contrib:float, r=giraffate

Stop suggesting a float truncation that is not shorter

Fixes #7721.

Previously Clippy would say that a number has excessive precision even if it has the minimum possible precision for the floating point value that it corresponds to.

changelog: Fix [`excessive_precision`] being triggered on floats that are already written in shortest form

2 years agoStop suggesting a float truncation that is not shorter
David Tolnay [Sun, 26 Sep 2021 05:54:08 +0000 (22:54 -0700)]
Stop suggesting a float truncation that is not shorter

2 years agoclippy lints: update doctest ranges to inclusive ones
Matthias Krüger [Fri, 10 Sep 2021 21:47:51 +0000 (23:47 +0200)]
clippy lints: update doctest ranges to inclusive ones

2 years agobump clippy crates to edition 2021
Matthias Krüger [Fri, 10 Sep 2021 20:57:00 +0000 (22:57 +0200)]
bump clippy crates to edition 2021

2 years agoAuto merge of #7669 - Labelray:if_then_panic, r=giraffate
bors [Fri, 24 Sep 2021 14:43:51 +0000 (14:43 +0000)]
Auto merge of #7669 - Labelray:if_then_panic, r=giraffate

New lint `if_then_panic`

changelog: add the new lint [`if_then_panic`]
fix #7645

2 years agoAuto merge of #7715 - F3real:vec2, r=camsteffen
bors [Fri, 24 Sep 2021 14:24:41 +0000 (14:24 +0000)]
Auto merge of #7715 - F3real:vec2, r=camsteffen

Avoid needless heap allocation in box_collection

Fix issue left from previous PR

changelog: none.

r? `@Manishearth`

2 years agoAdd new lint `if_then_panic`
Labelray [Tue, 14 Sep 2021 08:28:09 +0000 (16:28 +0800)]
Add new lint `if_then_panic`

2 years agoAvoid needless heap allocation in box_collection
F3real [Fri, 24 Sep 2021 09:02:16 +0000 (11:02 +0200)]
Avoid needless heap allocation in box_collection

2 years agoAuto merge of #7707 - Jarcho:suspicious_else_proc_mac, r=Manishearth
bors [Thu, 23 Sep 2021 16:14:29 +0000 (16:14 +0000)]
Auto merge of #7707 - Jarcho:suspicious_else_proc_mac, r=Manishearth

Don't lint `suspicious_else_formatting` inside proc-macros

fixes: #7650

I'll add a test for this one soon.

changelog: Don't lint `suspicious_else_formatting` inside proc-macros

2 years agoAdd test for #7650
Jason Newcomb [Thu, 23 Sep 2021 15:17:54 +0000 (11:17 -0400)]
Add test for #7650

2 years agoDon't lint `suspicious_else_formatting` inside proc-macros
Jason Newcomb [Thu, 23 Sep 2021 04:22:27 +0000 (00:22 -0400)]
Don't lint `suspicious_else_formatting` inside proc-macros

2 years agoAuto merge of #7693 - F3real:vec2, r=Manishearth
bors [Wed, 22 Sep 2021 22:13:13 +0000 (22:13 +0000)]
Auto merge of #7693 - F3real:vec2, r=Manishearth

Expand box_vec lint to box_collection

fixed #7451

changelog: Expand `box_vec` into [`box_collection`], and have it error on all sorts of boxed collections

2 years agoAdd missing reference to box_vec
F3real [Wed, 22 Sep 2021 17:59:32 +0000 (19:59 +0200)]
Add missing reference to box_vec

2 years agoAuto merge of #7704 - camsteffen:pedantic-occasional, r=Manishearth
bors [Wed, 22 Sep 2021 16:55:34 +0000 (16:55 +0000)]
Auto merge of #7704 - camsteffen:pedantic-occasional, r=Manishearth

Tweak pedantic description for occasional FPs

changelog: none

Okay this is getting a bit picky (you might even say pedantic). I think we need to be careful not use the pedantic category as cover-all for lints with any amount of false positives. Lints with a high degree of FPs should be nursery or restriction IMO. If the pedantic category were to yield, say hypothetically, over 50% FPs, it would just be too annoying to use at all (to be sure, "too picky for me" is not a FP).

CC `@rust-lang/clippy`

2 years agoTweak pedantic description for occasional FPs
Cameron Steffen [Wed, 22 Sep 2021 15:34:34 +0000 (10:34 -0500)]
Tweak pedantic description for occasional FPs

2 years agoAuto merge of #7679 - lengyijun:issue4546, r=xFrednet
bors [Wed, 22 Sep 2021 09:00:30 +0000 (09:00 +0000)]
Auto merge of #7679 - lengyijun:issue4546, r=xFrednet

add #4546 test

changelog: none
fixed #4546

I notice #4546 was fixed some time, I just add the tests.

2 years agoadd #4546 test
lengyijun [Fri, 17 Sep 2021 03:48:21 +0000 (11:48 +0800)]
add #4546 test

2 years agoAuto merge of #7685 - camsteffen:let-else-needless-ret, r=giraffate
bors [Wed, 22 Sep 2021 00:23:23 +0000 (00:23 +0000)]
Auto merge of #7685 - camsteffen:let-else-needless-ret, r=giraffate

Fix needless_return with let-else

changelog: Fix needless_return FP with `let...else`

Fixes #7637

2 years agoDemote float_cmp to pedantic
Jubilee Young [Sun, 19 Sep 2021 23:10:29 +0000 (16:10 -0700)]
Demote float_cmp to pedantic

2 years agoAuto merge of #7694 - Jarcho:lintcheck_retry, r=matthiaskrgr
bors [Tue, 21 Sep 2021 16:59:48 +0000 (16:59 +0000)]
Auto merge of #7694 - Jarcho:lintcheck_retry, r=matthiaskrgr

Retry on some download errors in lintcheck

I'm currently on spotty wifi right now. It is shocking the number of things that break when you lose connection for a few seconds. Some 500 errors should probably also be retried, but this fixes my issue.

changelog: None

2 years agoRegister lint rename
F3real [Mon, 20 Sep 2021 21:07:17 +0000 (23:07 +0200)]
Register lint rename

2 years agoRetry on some download errors in lintcheck
Jason Newcomb [Mon, 20 Sep 2021 16:50:59 +0000 (12:50 -0400)]
Retry on some download errors in lintcheck

2 years agoExpand BOX_VEC to BOX_COLLECTION
F3real [Fri, 17 Sep 2021 22:56:14 +0000 (00:56 +0200)]
Expand BOX_VEC to BOX_COLLECTION

2 years agoAuto merge of #7690 - Jarcho:while_loop_by_ref, r=xFrednet
bors [Sun, 19 Sep 2021 17:37:04 +0000 (17:37 +0000)]
Auto merge of #7690 - Jarcho:while_loop_by_ref, r=xFrednet

Change `while_let_on_iterator` suggestion to use `by_ref()`

It came up in the discussion #7659 that suggesting `iter.by_ref()` is a clearer suggestion than `&mut iter`. I personally think they're equivalent, but if `by_ref()` is clearer to people then that should be the suggestion.

changelog: Change `while_let_on_iterator` suggestion when using `&mut` to use `by_ref()`

2 years agoFix needless_return with let-else
Cameron Steffen [Sat, 18 Sep 2021 14:40:16 +0000 (09:40 -0500)]
Fix needless_return with let-else

2 years agoChange the suggestion for `while_let_on_iterator` when the iterator cannot be consume...
Jason Newcomb [Sat, 18 Sep 2021 01:44:21 +0000 (21:44 -0400)]
Change the suggestion for `while_let_on_iterator` when the iterator cannot be consumed to `iter.by_ref()`

2 years agoAuto merge of #7657 - dswij:needless-borrow-mut, r=llogiq
bors [Fri, 17 Sep 2021 22:25:07 +0000 (22:25 +0000)]
Auto merge of #7657 - dswij:needless-borrow-mut, r=llogiq

`needless_borrow` checks for mutable borrow

closes #7635

changelog: [`needless_borrow`] now checks for needless mutable borrow

2 years agoAuto merge of #7653 - lengyijun:same_name_method_crate, r=llogiq
bors [Fri, 17 Sep 2021 22:02:04 +0000 (22:02 +0000)]
Auto merge of #7653 - lengyijun:same_name_method_crate, r=llogiq

New lint: `same_name_method`

changelog: ``[`same_name_method`]``
fix: https://github.com/rust-lang/rust-clippy/issues/7632

It only compares a method in `impl` with another in `impl trait for`
It doesn't lint two methods in two traits.

I'm not sure my approach is the best way. I meet difficulty in other approaches.

2 years agoAuto merge of #7678 - lengyijun:issue3414, r=giraffate
bors [Fri, 17 Sep 2021 02:07:11 +0000 (02:07 +0000)]
Auto merge of #7678 - lengyijun:issue3414, r=giraffate

add #3414 test

changelog: none
fixes #3414

I found #3414 was fixed some time. So I add the tests.

2 years agoadd 3414 test
lyj [Thu, 16 Sep 2021 08:52:57 +0000 (16:52 +0800)]
add 3414 test

2 years agoAuto merge of #7671 - dtolnay-contrib:singlecharnames, r=xFrednet
bors [Tue, 14 Sep 2021 17:37:32 +0000 (17:37 +0000)]
Auto merge of #7671 - dtolnay-contrib:singlecharnames, r=xFrednet

Downgrade many_single_char_names to pedantic

As suggested by `@flip1995` in https://github.com/rust-lang/rust-clippy/issues/7666#issuecomment-918993215, by today's standards this lint would be considered `pedantic`.

This is one of the most widely suppressed Clippy lints on crates.io according to https://github.com/dtolnay/noisy-clippy.

In my opinion this lint is just too domain specific for Clippy to have reliable visibility into. Sure there are some cases where the author is just being lazy and could use a kick in the butt, but we're still left with an enormous number of suppressions where single chars are the most appropriate name. For example in the context of colors, a function using `h`, `s`, `l`, `r`, `g`, `b` is 100% sensible and spelling all those out is silly, but it's past the default lint threshold.

---

changelog: Moved [`many_single_char_names`] to `pedantic`

2 years agoDowngrade many_single_char_names to pedantic
David Tolnay [Tue, 14 Sep 2021 16:48:30 +0000 (09:48 -0700)]
Downgrade many_single_char_names to pedantic

2 years agoAuto merge of #7640 - kneasle:mut-key-false-positive, r=camsteffen
bors [Tue, 14 Sep 2021 15:56:07 +0000 (15:56 +0000)]
Auto merge of #7640 - kneasle:mut-key-false-positive, r=camsteffen

Improve accuracy of `mut_key`

Fixes #6745.

Whilst writing the tests for this, I noticed what I believe is a false negative (the code in `@xFrednet's` [comment](https://github.com/rust-lang/rust-clippy/issues/6745#issuecomment-909658267) doesn't trigger the lint).  Currently the tests contain a case for this (which is blatantly ignored), but I'm not at all sure how to implement this (since the lint currently behaves completely differently for ADTs).  I'm not sure what should be done - on the one hand the extra test cases are misleading, but on the other hand they don't cause much harm and would save effort for anyone fixing that false negative.

---

changelog: Improve accuracy of `clippy::mutable_key_type`.

2 years agoFix FN for collections/smart ptrs in `std`
Kneasle [Wed, 8 Sep 2021 21:51:47 +0000 (22:51 +0100)]
Fix FN for collections/smart ptrs in `std`

2 years agoAuto merge of #7670 - xFrednet:0000-lets-hope-this-fixes-rustbot-fps, r=camsteffen
bors [Tue, 14 Sep 2021 13:57:41 +0000 (13:57 +0000)]
Auto merge of #7670 - xFrednet:0000-lets-hope-this-fixes-rustbot-fps, r=camsteffen

Updating issue templates to avoid @rustbot triggers

This adds a space between the ``@`` and the name *rustbot*. This should now surely fix it. If not, I'm giving up.

@ rustbot label +C-bug

---

changelog: none

r? `@camsteffen`

2 years agoUpdating issue templates to avoid @rustbot triggers
xFrednet [Tue, 14 Sep 2021 13:49:43 +0000 (15:49 +0200)]
Updating issue templates to avoid @rustbot triggers

2 years agosame_name_method
lengyijun [Wed, 8 Sep 2021 02:36:51 +0000 (10:36 +0800)]
same_name_method

2 years agoFix FP when using raw pointers as hashed keys
Kneasle [Sun, 5 Sep 2021 20:58:47 +0000 (21:58 +0100)]
Fix FP when using raw pointers as hashed keys

2 years agoAuto merge of #7646 - camsteffen:relative-target, r=flip1995
bors [Mon, 13 Sep 2021 09:57:01 +0000 (09:57 +0000)]
Auto merge of #7646 - camsteffen:relative-target, r=flip1995

Target directory cleanup

changelog: none

* .cargo/config now has `target-dir` specified so that it is inherited by child projects. The target directory needs to be shared with clippy_dev, but not necessarily at the project root. (cc #7625)
* Uses `std::env::current_exe` (and its parent directories) whenever possible
* `CLIPPY_DRIVER_PATH` and `TARGET_LIBS` are no longer required from rustc bootstrap (but `HOST_LIBS` still is). These can be removed from the rustc side after merging.
* `CLIPPY_DOGFOOD` and the separate target directory are removed. This was originally added to mitigate #7343.

r? `@flip1995`

2 years agoUpdate `needless_borrow` test output and expected fix
dswij [Thu, 9 Sep 2021 15:38:03 +0000 (23:38 +0800)]
Update `needless_borrow` test output and expected fix

2 years agoFix `needless_borrow` not linting mutable reference
dswij [Thu, 9 Sep 2021 15:37:18 +0000 (23:37 +0800)]
Fix `needless_borrow` not linting mutable reference

2 years agoUpdate test for needless-borrow FP for mutable ref
dswij [Thu, 9 Sep 2021 15:33:28 +0000 (23:33 +0800)]
Update test for needless-borrow FP for mutable ref

2 years agoAuto merge of #7661 - camsteffen:eta, r=giraffate
bors [Mon, 13 Sep 2021 00:39:34 +0000 (00:39 +0000)]
Auto merge of #7661 - camsteffen:eta, r=giraffate

Fix various redundant_closure bugs

changelog: Fix various false negatives and false positives for [`redundant_closure`]

Closes #3071
Closes #4002

This lint is full of weird nuances and this is basically a re-write to tighten up the logic.

2 years agoAuto merge of #7663 - Jarcho:rsplit_once_order, r=llogiq
bors [Sat, 11 Sep 2021 08:29:52 +0000 (08:29 +0000)]
Auto merge of #7663 - Jarcho:rsplit_once_order, r=llogiq

Fix result order for `manual_split_once` when `rsplitn` is used

fixes: #7656

changelog: Fix result order for `manual_split_once` when `rsplitn` is used

2 years agoFix result order for `manual_split_once` when `rsplitn` is used
Jason Newcomb [Fri, 10 Sep 2021 16:20:39 +0000 (12:20 -0400)]
Fix result order for `manual_split_once` when `rsplitn` is used

2 years agoAuto merge of #7660 - HKalbasi:derivable-impls, r=camsteffen
bors [Fri, 10 Sep 2021 15:32:16 +0000 (15:32 +0000)]
Auto merge of #7660 - HKalbasi:derivable-impls, r=camsteffen

Fix derivable impl false positives

fix #7654
fix #7655

changelog: none (not released)

2 years agofix derivable impl false positives
hamidreza kalbasi [Fri, 10 Sep 2021 13:40:55 +0000 (18:10 +0430)]
fix derivable impl false positives

2 years agoEat dogfood
Cameron Steffen [Thu, 9 Sep 2021 20:36:06 +0000 (15:36 -0500)]
Eat dogfood

2 years agoFix redundant closure bugs
Cameron Steffen [Thu, 9 Sep 2021 20:35:26 +0000 (15:35 -0500)]
Fix redundant closure bugs

2 years agoAuto merge of #7649 - flip1995:backport_remerge, r=flip1995
bors [Thu, 9 Sep 2021 14:47:28 +0000 (14:47 +0000)]
Auto merge of #7649 - flip1995:backport_remerge, r=flip1995

Backport remerge

This is to keep the backported commit in the repository before force pushing the new beta branch.

r? `@ghost`

changelog: none
(literally none)

2 years agoMerge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 [Thu, 9 Sep 2021 14:45:20 +0000 (16:45 +0200)]
Merge remote-tracking branch 'upstream/beta' into backport_remerge

2 years agoAuto merge of #7610 - Labelray:master, r=camsteffen
bors [Thu, 9 Sep 2021 01:47:08 +0000 (01:47 +0000)]
Auto merge of #7610 - Labelray:master, r=camsteffen

Add new lint `iter_not_returning_iterator`

Add new lint [`iter_not_returning_iterator`] to detect method `iter()` or `iter_mut()` returning a type not implementing `Iterator`
changelog: Add new lint [`iter_not_returning_iterator`]

2 years agoAuto merge of #7621 - azdavis:master, r=camsteffen
bors [Thu, 9 Sep 2021 01:31:15 +0000 (01:31 +0000)]
Auto merge of #7621 - azdavis:master, r=camsteffen

Allow giving reasons for `disallowed_methods`

Fixes #7609.

This permits writing the config for `disallowed-methods` as either a list of strings (like before) or a list of tables, where each table gives the path to the disallowed method and an optional reason for why the method is disallowed.

changelog: Allow giving reasons for [`disallowed_methods`]

2 years agoadd new lint `iter_not_returning_iterator`
Labelray [Tue, 7 Sep 2021 01:59:21 +0000 (09:59 +0800)]
add new lint `iter_not_returning_iterator`

2 years agoAllow giving reasons for disallowed_methods
Ariel Davis [Thu, 9 Sep 2021 01:12:02 +0000 (21:12 -0400)]
Allow giving reasons for disallowed_methods

2 years agoRemove special dogfood target
Cameron Steffen [Wed, 8 Sep 2021 18:34:00 +0000 (13:34 -0500)]
Remove special dogfood target

2 years agoRemove target dir from aliases
Cameron Steffen [Wed, 8 Sep 2021 17:50:57 +0000 (12:50 -0500)]
Remove target dir from aliases

2 years agoRename test_build_base to test
Cameron Steffen [Wed, 8 Sep 2021 15:59:05 +0000 (10:59 -0500)]
Rename test_build_base to test

2 years agoUse relative path for test builds
Cameron Steffen [Wed, 8 Sep 2021 15:58:18 +0000 (10:58 -0500)]
Use relative path for test builds

2 years agoUse relative exe paths
Cameron Steffen [Wed, 8 Sep 2021 15:55:08 +0000 (10:55 -0500)]
Use relative exe paths

2 years agoMake host libs -L flag optional
Cameron Steffen [Wed, 8 Sep 2021 15:45:44 +0000 (10:45 -0500)]
Make host libs -L flag optional

2 years agoUse relative deps path
Cameron Steffen [Wed, 8 Sep 2021 15:41:09 +0000 (10:41 -0500)]
Use relative deps path

2 years agoAdd target to cargo config
Cameron Steffen [Wed, 8 Sep 2021 19:05:49 +0000 (14:05 -0500)]
Add target to cargo config

2 years agoAuto merge of #7631 - camsteffen:depinfo, r=flip1995
bors [Wed, 8 Sep 2021 13:30:11 +0000 (13:30 +0000)]
Auto merge of #7631 - camsteffen:depinfo, r=flip1995

Use binary-dep-depinfo to resolve UI test dependencies

Closes #7343
Closes #6809
Closes #3643

changelog: none

r? `@flip1995`
cc `@Jarcho`

2 years agoDeny warnings in test modules
Cameron Steffen [Wed, 8 Sep 2021 13:19:14 +0000 (08:19 -0500)]
Deny warnings in test modules

2 years agoUse binary-dep-depinfo to resolve UI dependencies
Cameron Steffen [Fri, 3 Sep 2021 20:24:29 +0000 (15:24 -0500)]
Use binary-dep-depinfo to resolve UI dependencies

2 years agoRemove unused dependencies
Cameron Steffen [Fri, 3 Sep 2021 20:55:14 +0000 (15:55 -0500)]
Remove unused dependencies

2 years agoAuto merge of #7644 - flip1995:rustup, r=flip1995
bors [Wed, 8 Sep 2021 09:00:54 +0000 (09:00 +0000)]
Auto merge of #7644 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump Clippy Version -> 0.1.57
flip1995 [Wed, 8 Sep 2021 08:59:04 +0000 (10:59 +0200)]
Bump Clippy Version -> 0.1.57

2 years agoBump nightly version -> 2021-09-08
flip1995 [Wed, 8 Sep 2021 08:58:51 +0000 (10:58 +0200)]
Bump nightly version -> 2021-09-08

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Wed, 8 Sep 2021 08:50:04 +0000 (10:50 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7607 - dswij:mut-range-bound-break, r=flip1995
bors [Wed, 8 Sep 2021 08:14:17 +0000 (08:14 +0000)]
Auto merge of #7607 - dswij:mut-range-bound-break, r=flip1995

`mut_range_bound` check for immediate break after mutation

closes #7532

`mut_range_bound` ignores mutation on range bounds that is placed immediately before break. Still warns if the break is not always reachable.

changelog: [`mut_range_bound`] ignore range bound mutations before immediate break

2 years agoAdd known problems to `mut_range_bound` docs
dswij [Mon, 6 Sep 2021 22:07:50 +0000 (06:07 +0800)]
Add known problems to `mut_range_bound` docs

2 years agoUpdate test output for `mut_range_bound`
dswij [Fri, 3 Sep 2021 04:27:05 +0000 (12:27 +0800)]
Update test output for `mut_range_bound`

2 years ago`mut_range_bound` to check for immediate break from loop
dswij [Thu, 2 Sep 2021 08:04:46 +0000 (16:04 +0800)]
`mut_range_bound` to check for immediate break from loop

2 years agoAdd additional test for broken loop in `mut_range_bound`
dswij [Thu, 26 Aug 2021 10:20:13 +0000 (18:20 +0800)]
Add additional test for broken loop in `mut_range_bound`

2 years agoAuto merge of #7642 - mikerite:fix-7641, r=flip1995
bors [Tue, 7 Sep 2021 08:16:36 +0000 (08:16 +0000)]
Auto merge of #7642 - mikerite:fix-7641, r=flip1995

Add `TAU` to `approx_constant`

changelog: [`approx_constant`]: Add `TAU`

2 years agoAdd `TAU` to `approx_constant`
Michael Wright [Tue, 7 Sep 2021 03:50:04 +0000 (05:50 +0200)]
Add `TAU` to `approx_constant`

2 years agoAuto merge of #7634 - chansuke:update-eval-order-depends-docs, r=Manishearth
bors [Mon, 6 Sep 2021 07:51:55 +0000 (07:51 +0000)]
Auto merge of #7634 - chansuke:update-eval-order-depends-docs, r=Manishearth

Fix documentation of eval_order_dependence

Fixes #7624.

changelog: fix documentation of eval_order_dependence

2 years agoAuto merge of #88493 - chenyukang:fix-duplicated-diagnostic, r=estebank
bors [Mon, 6 Sep 2021 00:14:41 +0000 (00:14 +0000)]
Auto merge of #88493 - chenyukang:fix-duplicated-diagnostic, r=estebank

Fix #88256 remove duplicated diagnostics

Fix #88256

2 years agoAuto merge of #7596 - lengyijun:option_needless_deref, r=llogiq
bors [Sun, 5 Sep 2021 18:11:56 +0000 (18:11 +0000)]
Auto merge of #7596 - lengyijun:option_needless_deref, r=llogiq

New lint: option_needless_deref

changelog: [`option_needless_deref`]
fix #7571

2 years agoAuto merge of #7638 - xFrednet:7569-avoid-indexing-in-clippy, r=Manishearth
bors [Sun, 5 Sep 2021 17:01:50 +0000 (17:01 +0000)]
Auto merge of #7638 - xFrednet:7569-avoid-indexing-in-clippy, r=Manishearth

Avoid slice indexing in Clippy (down with the ICEs)

While working on #7569 I got about 23 lint reports where we can avoid slice indexing by destructing the slice early. This is a preparation PR to avoid fixing them in the lint PR. (The implementation already takes about 300 lines without tests :sweat_smile:). Either way, this should hopefully be easy to review :upside_down_face:

---

changelog: none

2 years agoAuto merge of #88499 - eddyb:layout-off, r=nagisa
bors [Sun, 5 Sep 2021 16:14:41 +0000 (16:14 +0000)]
Auto merge of #88499 - eddyb:layout-off, r=nagisa

Provide `layout_of` automatically (given tcx + param_env + error handling).

After #88337, there's no longer any uses of `LayoutOf` within `rustc_target` itself, so I realized I could move the trait to `rustc_middle::ty::layout` and redesign it a bit.

This is similar to #88338 (and supersedes it), but at no ergonomic loss, since there's no funky `C: LayoutOf<Ty = Ty>` -> `Ty: TyAbiInterface<C>` generic `impl` chain, and each `LayoutOf` still corresponds to one `impl` (of `LayoutOfHelpers`) for the specific context.

After this PR, this is what's needed to get `trait LayoutOf` (with the `layout_of` method) implemented on some context type:
* `TyCtxt`, via `HasTyCtxt`
* `ParamEnv`, via `HasParamEnv`
* a way to transform `LayoutError`s into the desired error type
  * an error type of `!` can be paired with having `cx.layout_of(...)` return `TyAndLayout` *without* `Result<...>` around it, such as used by codegen
  * this is done through a new `LayoutOfHelpers` trait (and so is specifying the type of `cx.layout_of(...)`)

When going through this path (and not bypassing it with a manual `impl` of `LayoutOf`), the end result is that only the error case can be customized, the query itself and the success paths are guaranteed to be uniform.

(**EDIT**: just noticed that because of the supertrait relationship, you cannot actually implement `LayoutOf` yourself, the blanket `impl` fully covers all possible context types that could ever implement it)

Part of the motivation for this shape of API is that I've been working on querifying `FnAbi::of_*`, and what I want/need to introduce for that looks a lot like the setup in this PR - in particular, it's harder to express the `FnAbi` methods in `rustc_target`, since they're much more tied to `rustc` concepts.

r? `@nagisa` cc `@oli-obk` `@bjorn3`

2 years agoAuto merge of #7627 - xFrednet:0000-updating-issue-templates-again, r=llogiq
bors [Sun, 5 Sep 2021 14:53:33 +0000 (14:53 +0000)]
Auto merge of #7627 - xFrednet:0000-updating-issue-templates-again, r=llogiq

Updating issue templates again for rustbot

It turns out that our current issue template can sometimes trigger a rustbot error message, as can be seen in [#7626](https://github.com/rust-lang/rust-clippy/issues/7626). I originally tested this in #7599, but it's apparently a bit inconsistent. This PR adds backticks to the commands, as correctly suggested by `@mikerite` in the comments. (Thank you!)

``@rustbot` label +S-blocked`

---

Now I also pushed a tiny link fix as well. :upside_down_face:

---

changelog: none

2 years agoAuto merge of #7629 - mikerite:fix-7623-2, r=xFrednet
bors [Sun, 5 Sep 2021 13:17:02 +0000 (13:17 +0000)]
Auto merge of #7629 - mikerite:fix-7623-2, r=xFrednet

Make `approx_const` MSRV aware

changelog: [`approx_const`]: Add MRSV checks for LOG10_2 and LOG2_10.

Fixes #7623

2 years agoAvoid slice indexing in Clippy (down with the ICEs)
xFrednet [Sat, 4 Sep 2021 16:21:49 +0000 (18:21 +0200)]
Avoid slice indexing in Clippy (down with the ICEs)

2 years agoImprove `approx_constant` output
Michael Wright [Sun, 5 Sep 2021 06:42:00 +0000 (08:42 +0200)]
Improve `approx_constant` output

2 years agoAdd MSRV to `approx_constant` documentation
Michael Wright [Sun, 5 Sep 2021 06:19:30 +0000 (08:19 +0200)]
Add MSRV to `approx_constant` documentation

2 years agoUpdate clippy_lints/src/needless_option_as_deref.rs
lyj [Sun, 5 Sep 2021 00:33:04 +0000 (08:33 +0800)]
Update clippy_lints/src/needless_option_as_deref.rs

Co-authored-by: llogiq <bogusandre@gmail.com>
2 years agoAuto merge of #7570 - HKalbasi:derivable-impls, r=camsteffen
bors [Sat, 4 Sep 2021 21:40:04 +0000 (21:40 +0000)]
Auto merge of #7570 - HKalbasi:derivable-impls, r=camsteffen

Add the `derivable_impls` lint

Fix #7550

changelog: Add new derivable_impls lint. mem_replace_with_default now covers non constructor cases.