]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRemove empty lines in doc comment
Christian Nielsen [Thu, 29 Oct 2020 14:49:42 +0000 (15:49 +0100)]
Remove empty lines in doc comment

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoRemove unnecesary format
Urcra [Mon, 26 Oct 2020 00:55:44 +0000 (01:55 +0100)]
Remove unnecesary format

3 years agorun cargo fmt
Urcra [Mon, 26 Oct 2020 00:31:13 +0000 (01:31 +0100)]
run cargo fmt

3 years agoRun update lints
Urcra [Mon, 26 Oct 2020 00:21:34 +0000 (01:21 +0100)]
Run update lints

3 years agoAdd description to lint
Urcra [Mon, 26 Oct 2020 00:02:10 +0000 (01:02 +0100)]
Add description to lint

3 years agoRevert changes to Cargo.toml file
Urcra [Sun, 25 Oct 2020 23:53:51 +0000 (00:53 +0100)]
Revert changes to Cargo.toml file

3 years agoMove implementation into len_zero.rs
Urcra [Sun, 25 Oct 2020 23:51:18 +0000 (00:51 +0100)]
Move implementation into len_zero.rs

3 years agoInitial implementation of comparison_to_empty
Urcra [Sun, 25 Oct 2020 23:31:25 +0000 (00:31 +0100)]
Initial implementation of comparison_to_empty

3 years agoAuto merge of #6187 - geoffreycopin:master, r=ebroto
bors [Sat, 24 Oct 2020 23:29:49 +0000 (23:29 +0000)]
Auto merge of #6187 - geoffreycopin:master, r=ebroto

Lint unnecessary int-to-int and float-to-float casts

This is an implementation of a lint that detects unnecessary casts of number literals, as discussed here:
https://github.com/rust-lang/rust-clippy/issues/6116

---

changelog: lint unnecessary as-casts of literals when they could be written using literal syntax.

3 years agoAuto merge of #6190 - montrivo:manual_result_unwrap_or, r=ebroto
bors [Sat, 24 Oct 2020 23:09:14 +0000 (23:09 +0000)]
Auto merge of #6190 - montrivo:manual_result_unwrap_or, r=ebroto

manual_unwrap_or / support Result::unwrap_or

Implements partially #5923.

changelog: support Result::unwrap_or in manual_unwrap_or

3 years agoAuto merge of #6135 - cauebs:master, r=ebroto
bors [Sat, 24 Oct 2020 22:31:53 +0000 (22:31 +0000)]
Auto merge of #6135 - cauebs:master, r=ebroto

Add large_types_passed_by_value lint

Creates a new lint that checks for large function parameters passed by value. ~Types that are Copy were ignored, because I understand they are explicitly marked as being cheap (or just acceptable) to copy. Arrays were excluded from that restriction because they are always Copy, independently of the size, if the elements are Copy.~ Only Copy types are considered, because if a type is not Copy it cannot be dereferenced, as pointed out by `@ebroto,` and that would require analyzing the whole function body to check if the argument is moved somewhere else. `self` and `mut` parameters are also skipped.

I refactored `trivially_copy_pass_by_ref` and the new lint into a new `pass_by_ref_or_value` module, since both share most of their implementations, as was pointed out to me in #4499.

~Some questions that remain:~
~1. Should `self` be disregarded for this lint?~
~2. Should we special case types like Vec and String when suggesting changes? (to slices and &str)~
~3. What should be the default size limit?~
~4. Are there any special cases I'm missing?~

I ask the maintainers to add the `hacktoberfest-accepted` label if this PR is decent, even if there are some minor details to work out, but I do intend to stick around and finish the job.

Fixes #4499

changelog: Add new lint [`large_types_passed_by_value`]

3 years agoAdd large_types_passed_by_value lint
CauĂȘ Baasch de Souza [Thu, 8 Oct 2020 05:17:32 +0000 (02:17 -0300)]
Add large_types_passed_by_value lint

Refactor trivially_copy_pass_by_ref and the new lint into pass_by_ref_or_value module

Update stderr of conf_unknown_key test

Rename lint to large_types_passed_by_value

Increase `pass_by_value_size_limit` default value to 256

Improve rules for `large_types_passed_by_value`

Improve tests for `large_types_passed_by_value`

Improve documentation for `large_types_passed_by_value`

Make minor corrections to pass_by_ref_or_value.rs suggested by clippy itself

Fix `large_types_passed_by_value` example and improve docs

pass_by_ref_or_value: Tweak check for mut annotation in params

large_types_passed_by_value: add tests for pub trait, trait impl and inline attributes

3 years agoKeep separators in cast_size_32bits stderr
Geoffrey Copin [Sat, 24 Oct 2020 12:07:34 +0000 (14:07 +0200)]
Keep separators in cast_size_32bits stderr

3 years agomanual-unwrap-or / pr remarks, round 3
Tim Nielens [Sat, 24 Oct 2020 09:35:05 +0000 (11:35 +0200)]
manual-unwrap-or / pr remarks, round 3

3 years agoKeep sign in int-to-float casts
Geoffrey Copin [Fri, 23 Oct 2020 21:40:57 +0000 (23:40 +0200)]
Keep sign in int-to-float casts

3 years agoAuto merge of #6206 - ebroto:rustup, r=ebroto
bors [Fri, 23 Oct 2020 16:58:39 +0000 (16:58 +0000)]
Auto merge of #6206 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Fri, 23 Oct 2020 12:37:17 +0000 (14:37 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoFix test file
Geoffrey Copin [Thu, 22 Oct 2020 22:04:27 +0000 (00:04 +0200)]
Fix test file

3 years agoAdd test case for negative literals
Geoffrey Copin [Thu, 22 Oct 2020 22:04:27 +0000 (00:04 +0200)]
Add test case for negative literals

3 years agoAddress review comments
Geoffrey Copin [Thu, 22 Oct 2020 21:53:50 +0000 (23:53 +0200)]
Address review comments

3 years agomanual-unwrap-or / pr remarks, round 2
Tim Nielens [Thu, 22 Oct 2020 21:39:59 +0000 (23:39 +0200)]
manual-unwrap-or / pr remarks, round 2

3 years agomanual-unwrap-or / pr remarks
Tim Nielens [Thu, 22 Oct 2020 20:46:10 +0000 (22:46 +0200)]
manual-unwrap-or / pr remarks

3 years agoFix clippy tests
varkor [Thu, 22 Oct 2020 12:23:14 +0000 (13:23 +0100)]
Fix clippy tests

3 years agoAuto merge of #6203 - giraffate:fix_link_to_labeled_issues, r=Manishearth
bors [Thu, 22 Oct 2020 07:37:02 +0000 (07:37 +0000)]
Auto merge of #6203 - giraffate:fix_link_to_labeled_issues, r=Manishearth

Fix links to labeled issues

These labels seems wrong.
- <https://github.com/rust-lang/rust-clippy/labels/L-crash%20%3Aboom%3A>
- <https://github.com/rust-lang/rust-clippy/labels/L-bug%20%3Abeetle%3A>

changelog: none

3 years agoFix links to labeled issues
Takayuki Nakata [Wed, 21 Oct 2020 23:51:03 +0000 (08:51 +0900)]
Fix links to labeled issues

3 years agoAuto merge of #6193 - Ryan1729:add-more-LintStore-documentation, r=phansch
bors [Tue, 20 Oct 2020 09:38:38 +0000 (09:38 +0000)]
Auto merge of #6193 - Ryan1729:add-more-LintStore-documentation, r=phansch

Add more infomation about LintStore registration

Backstory: I somehow missed the fact that I needed to register a lint pass in order for it to run, and I spent some time confused until I figured it out. So I wanted to make it clear that a missing `register_(early|late)_pass` call is a likely cause of a lint not running.

changelog: none

3 years agoAuto merge of #6167 - ThibsG:IdenticalArgumentsAssertEq3574, r=ebroto
bors [Mon, 19 Oct 2020 19:50:12 +0000 (19:50 +0000)]
Auto merge of #6167 - ThibsG:IdenticalArgumentsAssertEq3574, r=ebroto

Identical arguments on assert macro family

Lint when identical args are used on `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros.

Added to the lint `eq_op`.

Common functions added to `utils/higher.rs`

Fixes: #3574
Fixes: #4694
changelog: Lint on identical args when calling `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros

3 years agoSplit `eq_op` ui tests to avoid file limit error in CI
ThibsG [Mon, 19 Oct 2020 15:31:41 +0000 (17:31 +0200)]
Split `eq_op` ui tests to avoid file limit error in CI

3 years agoAuto merge of #6166 - achris:master, r=flip1995
bors [Mon, 19 Oct 2020 13:17:07 +0000 (13:17 +0000)]
Auto merge of #6166 - achris:master, r=flip1995

Suggest a compatible shell for setup-toolchain.sh

setup-toolchain.sh uses "[[" which is a bash builtin, but the guide
suggests running it with sh.  On Ubuntu, /bin/sh points to dash and
running the script fails.

---

*Please keep the line below*
changelog: none

3 years agoAuto merge of #6195 - giraffate:sync-from-rust, r=ebroto
bors [Mon, 19 Oct 2020 06:01:21 +0000 (06:01 +0000)]
Auto merge of #6195 - giraffate:sync-from-rust, r=ebroto

Rustup

I followed these steps: <https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md#fixing-build-failures-caused-by-rust>.

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into sync-from-rust
Takayuki Nakata [Mon, 19 Oct 2020 04:05:51 +0000 (13:05 +0900)]
Merge remote-tracking branch 'upstream/master' into sync-from-rust

3 years agoAdd more infomation about LintStore registration
Ryan Wiedemann [Sun, 18 Oct 2020 23:01:57 +0000 (17:01 -0600)]
Add more infomation about LintStore registration

Backstory: I somehow missed the fact that I needed to register a lint pass in order for it to run, and I spent some time confused until I figured it out. So I wanted to make it clear that a missing `register_(early|late)_pass` call is a likely cause of a lint not running.

3 years agomanual_unwrap_or / support Result::unwrap_or
Tim Nielens [Sat, 17 Oct 2020 23:11:59 +0000 (01:11 +0200)]
manual_unwrap_or / support Result::unwrap_or

3 years agoAuto merge of #6189 - ebroto:rustup, r=ebroto
bors [Sat, 17 Oct 2020 20:13:34 +0000 (20:13 +0000)]
Auto merge of #6189 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Sat, 17 Oct 2020 19:55:46 +0000 (21:55 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRollup merge of #77851 - exrook:split-btreemap, r=dtolnay
Yuki Okushi [Sat, 17 Oct 2020 19:11:07 +0000 (04:11 +0900)]
Rollup merge of #77851 - exrook:split-btreemap, r=dtolnay

BTreeMap: refactor Entry out of map.rs into its own file

btree/map.rs is approaching the 3000 line mark, splitting out the entry
code buys about 500 lines of headroom.

I've created this PR because the changes I've made in #77438 will push `map.rs` over the 3000 line limit and cause tidy to complain.

I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations.

Related: #60302

3 years agoAppease the almightly lord clippy, hallowed be thy name
Jacob Hughes [Sat, 17 Oct 2020 17:45:40 +0000 (13:45 -0400)]
Appease the almightly lord clippy, hallowed be thy name

3 years agoLint unnecessary int-to-int and float-to-float casts
Geoffrey Copin [Thu, 15 Oct 2020 22:22:35 +0000 (00:22 +0200)]
Lint unnecessary int-to-int and float-to-float casts

3 years agoAssert macro args extractor as a common function in higher
ThibsG [Fri, 16 Oct 2020 15:58:26 +0000 (17:58 +0200)]
Assert macro args extractor as a common function in higher

3 years agoAuto merge of #6123 - montrivo:less_concise_than, r=ebroto
bors [Fri, 16 Oct 2020 20:43:45 +0000 (20:43 +0000)]
Auto merge of #6123 - montrivo:less_concise_than, r=ebroto

add lint manual_unwrap_or

Implements partially #5923.

changelog: add lint manual_unwrap_or

3 years agoAuto merge of #6184 - ebroto:bump_cargo_metadata, r=ebroto
bors [Fri, 16 Oct 2020 20:20:05 +0000 (20:20 +0000)]
Auto merge of #6184 - ebroto:bump_cargo_metadata, r=ebroto

bump cargo_metadata version

changelog: none

r? `@ghost` (master broken)

3 years agoHandle ExprKind::ConstBlock on clippy
Santiago Pastorino [Tue, 6 Oct 2020 21:51:31 +0000 (18:51 -0300)]
Handle ExprKind::ConstBlock on clippy

3 years agobump cargo_metadata version
Eduardo Broto [Fri, 16 Oct 2020 20:11:37 +0000 (22:11 +0200)]
bump cargo_metadata version

3 years agoAuto merge of #6180 - flip1995:rustup, r=flip1995
bors [Fri, 16 Oct 2020 12:24:23 +0000 (12:24 +0000)]
Auto merge of #6180 - flip1995:rustup, r=flip1995

Update semver 0.10 -> 0.11

r? `@ghost,` blocking CI

changelog: none

3 years agoUpdate semver 0.10 -> 0.11
flip1995 [Fri, 16 Oct 2020 12:23:17 +0000 (14:23 +0200)]
Update semver 0.10 -> 0.11

3 years agoAuto merge of #6178 - josephlr:sync-from-rust, r=phansch
bors [Fri, 16 Oct 2020 07:45:42 +0000 (07:45 +0000)]
Auto merge of #6178 - josephlr:sync-from-rust, r=phansch

Sync from rust

Fix rustc breakage by running:
```rust
git subtree push -P src/tools/clippy git@github.com:josephlr/rust-clippy sync-from-rust
```
and then adding a commit that runs `cargo dev fmt`

---

changelog: none

3 years agoRun cargo dev fmt
Joe Richey [Fri, 16 Oct 2020 05:37:53 +0000 (22:37 -0700)]
Run cargo dev fmt

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agoRollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_sta...
Dylan DPC [Fri, 16 Oct 2020 00:10:09 +0000 (02:10 +0200)]
Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk

ICEs should always print the top of the query stack

see #76920

3 years agoRemove rustc_session::config::Config
est31 [Wed, 14 Oct 2020 16:42:13 +0000 (18:42 +0200)]
Remove rustc_session::config::Config

The wrapper type led to tons of target.target
across the compiler. Its ptr_width field isn't
required any more, as target_pointer_width
is already present in parsed form.

3 years agoAuto merge of #6173 - Lotterleben:docs-typo, r=ebroto
bors [Thu, 15 Oct 2020 00:24:39 +0000 (00:24 +0000)]
Auto merge of #6173 - Lotterleben:docs-typo, r=ebroto

README: sort en/disabling section, fix typos, add note

it took me a while to figure out why `cargo clippy -- -Aclippy::pedantic -Wclippy::items-after-statements` still showed me *all* the lints. At first I thought it was due to the missing spaces in the current example and I debugged that until I stumbled across an issue noting that you have to touch a random file or run `cargo clean` when you're running clippy repeatedly on an unchanged codebase. This PR is an attempt to save the next person some time and also structure the "Allowing/denying lints" section a bit more while we're at it.

---
*Please keep the line below*
changelog: none

3 years agoAuto merge of #6174 - upsuper-forks:transmute-ptr-to-ref-issue, r=Manishearth
bors [Wed, 14 Oct 2020 21:54:32 +0000 (21:54 +0000)]
Auto merge of #6174 - upsuper-forks:transmute-ptr-to-ref-issue, r=Manishearth

Add a known problem for transmute_ptr_to_ref lint

changelog: none

3 years agoAuto merge of #6175 - ebroto:fix_remark, r=ebroto
bors [Wed, 14 Oct 2020 21:31:15 +0000 (21:31 +0000)]
Auto merge of #6175 - ebroto:fix_remark, r=ebroto

Fix remark linting on checkboxes

changelog: none

r? `@ghost` since this is blocking CI

3 years agoFix remark linting on checkboxes
Eduardo Broto [Wed, 14 Oct 2020 21:26:48 +0000 (23:26 +0200)]
Fix remark linting on checkboxes

3 years agomanual-unwrap-or / remove unwrap_or_else suggestion due to ownership issues
Tim Nielens [Wed, 14 Oct 2020 20:09:28 +0000 (22:09 +0200)]
manual-unwrap-or / remove unwrap_or_else suggestion due to ownership issues

3 years agomanual-unwrap-or / more pr remarks
Tim Nielens [Tue, 13 Oct 2020 08:24:00 +0000 (10:24 +0200)]
manual-unwrap-or / more pr remarks

3 years agomanual_unwrap_or / use consts::constant_simple helper
Tim Nielens [Sun, 11 Oct 2020 22:06:21 +0000 (00:06 +0200)]
manual_unwrap_or / use consts::constant_simple helper

3 years agomanual-unwrap-or / pr remarks
Tim Nielens [Sun, 11 Oct 2020 20:55:05 +0000 (22:55 +0200)]
manual-unwrap-or / pr remarks

3 years agomanual-unwrap-or / rename files
Tim Nielens [Sun, 11 Oct 2020 20:42:45 +0000 (22:42 +0200)]
manual-unwrap-or / rename files

3 years agoadd lint less_concise_than_option_unwrap_or
Tim Nielens [Tue, 6 Oct 2020 09:49:08 +0000 (11:49 +0200)]
add lint less_concise_than_option_unwrap_or

3 years agoAdd iterator test case for `eq_op` lint
ThibsG [Wed, 14 Oct 2020 19:29:53 +0000 (21:29 +0200)]
Add iterator test case for `eq_op` lint

3 years agofix stderr file of clippy/custom_ice_message test
hosseind88 [Wed, 14 Oct 2020 14:49:26 +0000 (18:19 +0330)]
fix stderr file of clippy/custom_ice_message test

3 years agoREADME: sort en/disabling section, fix typos, add note
Lotte Steenbrink [Wed, 14 Oct 2020 09:58:22 +0000 (11:58 +0200)]
README: sort en/disabling section, fix typos, add note

3 years agoAdd a known problem for transmute_ptr_to_ref lint
Xidorn Quan [Wed, 14 Oct 2020 12:15:01 +0000 (23:15 +1100)]
Add a known problem for transmute_ptr_to_ref lint

3 years agoMove linting of `assert` macros from early to late pass
ThibsG [Tue, 13 Oct 2020 21:46:23 +0000 (23:46 +0200)]
Move linting of `assert` macros from early to late pass

3 years agoAuto merge of #6169 - ThibsG:SameFunctionsInIfConditionIgnoreMacro, r=ebroto
bors [Tue, 13 Oct 2020 16:01:11 +0000 (16:01 +0000)]
Auto merge of #6169 - ThibsG:SameFunctionsInIfConditionIgnoreMacro, r=ebroto

Fix FP in `same_functions_in_if_condition` lint about condition as macro

Ignore expr that originate from a macro.

Fixes: #6168
changelog: none

3 years agoAuto merge of #6172 - ebroto:rustup, r=ebroto
bors [Tue, 13 Oct 2020 15:28:50 +0000 (15:28 +0000)]
Auto merge of #6172 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Tue, 13 Oct 2020 15:16:14 +0000 (17:16 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoFix FP in `same_functions_in_if_condition` lint about condition as macro
ThibsG [Tue, 13 Oct 2020 09:17:51 +0000 (11:17 +0200)]
Fix FP in `same_functions_in_if_condition` lint about condition as macro

3 years agoExtend to the `assert` macro family
ThibsG [Tue, 13 Oct 2020 07:31:53 +0000 (09:31 +0200)]
Extend to the `assert` macro family

3 years agosuggest a compatible shell for running setup-toolchain.sh
Chris Ayoup [Tue, 13 Oct 2020 01:51:05 +0000 (21:51 -0400)]
suggest a compatible shell for running setup-toolchain.sh

setup-toolchain.sh uses "[[" which is a bash builtin, but the guide
suggests running it with sh.  On Ubuntu, /bin/sh points to dash and
running the script as described fails.

3 years agoAuto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obk
bors [Tue, 13 Oct 2020 00:57:03 +0000 (00:57 +0000)]
Auto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obk

Refactor how SwitchInt stores jump targets

Closes https://github.com/rust-lang/rust/issues/65693

3 years agoLint on identical variable used as args in `assert_eq!` macro call
ThibsG [Thu, 8 Oct 2020 21:02:16 +0000 (23:02 +0200)]
Lint on identical variable used as args in `assert_eq!` macro call

3 years agoAuto merge of #6163 - phansch:remove-one-lazy-static, r=flip1995
bors [Mon, 12 Oct 2020 20:59:43 +0000 (20:59 +0000)]
Auto merge of #6163 - phansch:remove-one-lazy-static, r=flip1995

Remove lazy_static completely and use once_cell feature instead

Follow-up to https://github.com/rust-lang/rust-clippy/pull/6120

This removes the last remaining `lazy_static` usages and replaces them with `SyncLazy` from the `once_cell` feature.

---

changelog: none

3 years agofmt
Philipp Hansch [Mon, 12 Oct 2020 16:34:06 +0000 (18:34 +0200)]
fmt

3 years agodriver.rs: Replace lazy_static with once_cell
Philipp Hansch [Mon, 12 Oct 2020 16:29:29 +0000 (18:29 +0200)]
driver.rs: Replace lazy_static with once_cell

3 years agolintlist.rs: Replace lazy_static with once_cell
Philipp Hansch [Mon, 12 Oct 2020 14:50:34 +0000 (16:50 +0200)]
lintlist.rs: Replace lazy_static with once_cell

Follow-up to https://github.com/rust-lang/rust-clippy/pull/6120

3 years agoAuto merge of #6158 - giraffate:improve_updating_references, r=phansch
bors [Mon, 12 Oct 2020 13:49:19 +0000 (13:49 +0000)]
Auto merge of #6158 - giraffate:improve_updating_references, r=phansch

Remove the generated files by `update-references.sh` if they are empty

An empty file may be generated by `update-references.sh` and committed as is when creating a patch like https://github.com/rust-lang/rust-clippy/pull/6101#issuecomment-702076508 and https://github.com/rust-lang/rust-clippy/pull/6079#pullrequestreview-496502721. So, I think it would be helpful to add documentation, and automatically remove the generated file if it's empty.

changelog: none

3 years agoAuto merge of #6157 - rust-lang:result-unit-err, r=ebroto
bors [Sun, 11 Oct 2020 20:40:43 +0000 (20:40 +0000)]
Auto merge of #6157 - rust-lang:result-unit-err, r=ebroto

New lint: result-unit-err

This fixes #1721.

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `cargo dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

---

changelog: new lint: result-unit-err

3 years agoUse lowercase in error messages
Eduardo Broto [Sun, 11 Oct 2020 20:15:56 +0000 (22:15 +0200)]
Use lowercase in error messages

3 years agoNew lint: result-unit-err
Andre Bogus [Sun, 11 Oct 2020 11:27:20 +0000 (13:27 +0200)]
New lint: result-unit-err

3 years agoAuto merge of #6160 - ebroto:rustup, r=ebroto
bors [Sun, 11 Oct 2020 16:26:46 +0000 (16:26 +0000)]
Auto merge of #6160 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Sun, 11 Oct 2020 16:09:31 +0000 (18:09 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRemove the generated files by `update-references.sh` if they are empty
Takayuki Nakata [Sun, 11 Oct 2020 13:57:22 +0000 (22:57 +0900)]
Remove the generated files by `update-references.sh` if they are empty

3 years agoAuto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper
bors [Sun, 11 Oct 2020 01:26:06 +0000 (01:26 +0000)]
Auto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper

Replace run_compiler with RunCompiler builder pattern

Fixes #77286. Replaces rustc_driver:run_compiler with RunCompiler builder pattern.

3 years agoRefactor how SwitchInt stores jump targets
Jonas Schievink [Sat, 10 Oct 2020 15:36:04 +0000 (17:36 +0200)]
Refactor how SwitchInt stores jump targets

3 years agoAuto merge of #6154 - flip1995:ice_fixes, r=ebroto
bors [Sat, 10 Oct 2020 13:29:05 +0000 (13:29 +0000)]
Auto merge of #6154 - flip1995:ice_fixes, r=ebroto

Fix two ICEs caused by ty.is_{sized,freeze}

Fixes #6153
Properly fixes #6139

The test case in #6153 is kind of weird. Even removing one of the arguments of the `foo` function prevented the ICE. I think this test case is actually minimal.

changelog: none

3 years agoAdd test for ICE #6153
flip1995 [Sat, 10 Oct 2020 13:03:49 +0000 (15:03 +0200)]
Add test for ICE #6153

3 years agoFix two ICEs caused by ty.is_{sized,freeze}
flip1995 [Sat, 10 Oct 2020 12:04:14 +0000 (14:04 +0200)]
Fix two ICEs caused by ty.is_{sized,freeze}

3 years agoAuto merge of #6107 - nahuakang:ref_style_link_false_positive, r=flip1995
bors [Sat, 10 Oct 2020 09:25:46 +0000 (09:25 +0000)]
Auto merge of #6107 - nahuakang:ref_style_link_false_positive, r=flip1995

Ref style link false positive

This PR does not fix #5834, but it records the problematic link text as a **known problem** inside `doc_markdown` lint.

r? `@flip1995`

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `cargo dev update_lints`
- [ ] Added lint documentation
- [x] Run `cargo dev fmt`

---

*Please keep the line below*
changelog: Document problematic link text style as known problem for `doc_markdown`

3 years agoAuto merge of #5727 - rail-rain:manual_memcpy_with_counter, r=flip1995
bors [Sat, 10 Oct 2020 06:32:32 +0000 (06:32 +0000)]
Auto merge of #5727 - rail-rain:manual_memcpy_with_counter, r=flip1995

Expands `manual_memcpy` to lint ones with loop counters

Closes #1670

This PR expands `manual_memcpy` to lint ones with loop counters as described in https://github.com/rust-lang/rust-clippy/issues/1670#issuecomment-293280204

Although the current code is working, I have a couple of questions and concerns.

~~Firstly, I manually implemented `Clone` for `Sugg` because `AssocOp` lacks `Clone`. As `AssocOp` only holds an enum, which is `Copy`, as a value, it seems `AssocOp` can be `Clone`; but, I was not sure where to ask it. Should I make a PR to `rustc`?~~ The [PR]( https://github.com/rust-lang/rust/pull/73629) was made.

Secondly, manual copying with loop counters are likely to trigger `needless_range_loop` and `explicit_counter_loop` along with `manual_memcpy`; in fact, I explicitly allowed them in the tests. Is there any way to disable these two lints when a code triggers `manual_memcpy`?

And, another thing I'd like to note is that `Sugg` adds unnecessary parentheses when expressions with parentheses passed to its `hir` function, as seen here:

```
error: it looks like you're manually copying between slices
  --> $DIR/manual_memcpy.rs:145:14
   |
LL |     for i in 3..(3 + src.len()) {
   |              ^^^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[3..((3 + src.len()))].clone_from_slice(&src[..((3 + src.len()) - 3)])
```

However, using the `hir` function is needed to prevent the suggestion causing  errors when users use bitwise operations; and also this have already existed, for example: `verbose_bit_mask`. Thus, I think this is fine.

changelog: Expands `manual_memcpy` to lint ones with loop counters

3 years agoAuto merge of #6151 - bofh69:master, r=ebroto
bors [Fri, 9 Oct 2020 23:14:58 +0000 (23:14 +0000)]
Auto merge of #6151 - bofh69:master, r=ebroto

Preserve raw strs for: format!(s) to s.to_string() lint

fixes #6142

clippy::useless_format will keep the source's string (after converting {{ and }} to { and }) when suggesting a change from format!() to .to_string() usage. Ie:
|     let s = format!(r#""hello {{}}""#);
|             ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `r#""hello {}""#.to_string()`

changelog: [`useless_format`]: preserve raw string literals when no arguments to `format!()` are provided.

3 years agoAuto merge of #6144 - rust-lang:float-cmp-ref, r=ebroto
bors [Fri, 9 Oct 2020 22:28:00 +0000 (22:28 +0000)]
Auto merge of #6144 - rust-lang:float-cmp-ref, r=ebroto

allow refs in our constant folder

This helps with #3804 (but won't completely fix it).

---

changelog: none

3 years agoAuto merge of #6152 - flip1995:ice_6139, r=ebroto
bors [Fri, 9 Oct 2020 20:39:26 +0000 (20:39 +0000)]
Auto merge of #6152 - flip1995:ice_6139, r=ebroto

Fixes ICE 6139

Fixes #6139

Kind of hacky, but this should be fine.

changelog: none

3 years ago(Hacky) Fix for ICE #6139
flip1995 [Fri, 9 Oct 2020 20:22:21 +0000 (22:22 +0200)]
(Hacky) Fix for ICE #6139

3 years agoAdd regression test for ICE 6139
flip1995 [Fri, 9 Oct 2020 20:21:47 +0000 (22:21 +0200)]
Add regression test for ICE 6139

3 years agoallow refs in our constant handling
Andre Bogus [Thu, 8 Oct 2020 22:49:27 +0000 (00:49 +0200)]
allow refs in our constant handling

3 years agoPreserve raw strs for: format!(s) to s.to_string() lint
Sebastian Andersson [Fri, 9 Oct 2020 18:23:03 +0000 (20:23 +0200)]
Preserve raw strs for: format!(s) to s.to_string() lint

Ie:
|     let s = format!(r#""hello""#);
|             ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `r#""hello""#.to_string()`

3 years agorebase with master
hosseind75 [Tue, 29 Sep 2020 14:44:07 +0000 (18:14 +0330)]
rebase with master

3 years agoadd new line
hosseind75 [Mon, 28 Sep 2020 18:37:31 +0000 (22:07 +0330)]
add new line

3 years agofix clippy custom_ice_message test
hosseind75 [Fri, 25 Sep 2020 16:25:32 +0000 (19:55 +0330)]
fix clippy custom_ice_message test