]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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

3 years agorun full query stack print just when RUST_BACKTRACE is set
hosseind75 [Sat, 19 Sep 2020 14:07:58 +0000 (18:37 +0430)]
run full query stack print just when RUST_BACKTRACE is set

3 years agoICEs should print the top of the query stack
hosseind75 [Sat, 19 Sep 2020 13:21:24 +0000 (17:51 +0430)]
ICEs should print the top of the query stack

3 years agoAuto merge of #6130 - Ambroisie:lint-ptr-eq, r=Manishearth
bors [Fri, 9 Oct 2020 16:46:09 +0000 (16:46 +0000)]
Auto merge of #6130 - Ambroisie:lint-ptr-eq, r=Manishearth

New lint: Recommend using `ptr::eq` when possible

This is based almost entirely on the code available in the previous PR #4596. I merely updated the code to make it compile.

Fixes #3661.

- [ ] I'm not sure about the lint name, but it was the one used in the original PR.
- [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`

---

changelog: none

3 years agoAuto merge of #6150 - flip1995:backport_doc_update, r=ebroto
bors [Fri, 9 Oct 2020 13:44:01 +0000 (13:44 +0000)]
Auto merge of #6150 - flip1995:backport_doc_update, r=ebroto

Update backport documentation to the subtree workflow

changelog: none

3 years agoAuto merge of #6149 - flip1995:update_actions, r=ebroto
bors [Fri, 9 Oct 2020 13:23:01 +0000 (13:23 +0000)]
Auto merge of #6149 - flip1995:update_actions, r=ebroto

Remove deprecated set-env from GHA

This updates all of our action dependencies and removes every usage of `set-env`. `set-env` and `add-path` has been deprecated: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

changelog: none

3 years agoAuto merge of #6148 - flip1995:release_doc, r=ebroto
bors [Fri, 9 Oct 2020 13:02:25 +0000 (13:02 +0000)]
Auto merge of #6148 - flip1995:release_doc, r=ebroto

Update release documentation

When updating the beta branch, we want to reset, instead of rebase. Otherwise we might produce again new commits on the beta branch, that aren't on the master branch.

changelog: none

3 years agoAuto merge of #6131 - Ambroisie:fix-doc-tools, r=flip1995
bors [Fri, 9 Oct 2020 12:41:08 +0000 (12:41 +0000)]
Auto merge of #6131 - Ambroisie:fix-doc-tools, r=flip1995

Rename tables to typecheck_result()

While working on #6130, I noticed that part of the documentation was updated to use `LateContext::typeck_results`, but the paragraph still referred to the old `tables` field of `LateContext`.

---

*Please keep the line below*
changelog: none

3 years agoAuto merge of #6146 - woshilapin:patch-1, r=flip1995
bors [Fri, 9 Oct 2020 12:20:29 +0000 (12:20 +0000)]
Auto merge of #6146 - woshilapin:patch-1, r=flip1995

clippy_lint: Fix doc on 'option_if_let_else'

changelog: none

3 years agoUpdate backport documentation to the subtree workflow
flip1995 [Fri, 9 Oct 2020 12:14:49 +0000 (14:14 +0200)]
Update backport documentation to the subtree workflow

3 years agoMerge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup
flip1995 [Fri, 9 Oct 2020 10:45:29 +0000 (12:45 +0200)]
Merge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup

3 years agoUse defaults.run.shell instead of setting shell every time
flip1995 [Fri, 9 Oct 2020 09:53:10 +0000 (11:53 +0200)]
Use defaults.run.shell instead of setting shell every time

3 years agoRemove all usage of set-env
flip1995 [Fri, 9 Oct 2020 08:40:04 +0000 (10:40 +0200)]
Remove all usage of set-env

3 years agoAuto merge of #6136 - dtolnay:serve, r=flip1995
bors [Fri, 9 Oct 2020 08:58:19 +0000 (08:58 +0000)]
Auto merge of #6136 - dtolnay:serve, r=flip1995

Clippy dev subcommand to build and serve website

This PR adds `clippy dev serve` which will pop open a browser with a local rendered 'ALL the Clippy Lints' website, and re-render as you edit stuff.

---

changelog: none

3 years agoAuto merge of #6115 - ebroto:changelog_1_48, r=flip1995
bors [Fri, 9 Oct 2020 08:09:23 +0000 (08:09 +0000)]
Auto merge of #6115 - ebroto:changelog_1_48, r=flip1995

Add changelog for 1.48 beta

[Rendered](https://github.com/ebroto/rust-clippy/blob/changelog_1_48/CHANGELOG.md)

I've not added the PRs fixing `same_item_push` because those were backported, namely:
* [#5908](https://github.com/rust-lang/rust-clippy/pull/5908)
* [#5997](https://github.com/rust-lang/rust-clippy/pull/5997)
* [#6016](https://github.com/rust-lang/rust-clippy/pull/6016)

The following PR was reverted, so I've ignored it too:
* [#5984](https://github.com/rust-lang/rust-clippy/pull/5984)

~~Also, I took the liberty of adding a "Thanks" section, naming all the contributors to this release. I think they deserve visibility in the changelog. Please tell me if we want to add this or maybe it's redundant given we link to the PRs?~~

changelog: none

r? `@flip1995`

3 years agoclippy_lint: Fix doc on 'option_if_let_else'
Jean SIMARD [Fri, 9 Oct 2020 07:47:53 +0000 (09:47 +0200)]
clippy_lint: Fix doc on 'option_if_let_else'

- a typo in `expresion`
- a useless double space
- Some back-tick quotes for 'if let'

3 years agoUpdate release documentation
flip1995 [Fri, 9 Oct 2020 07:40:57 +0000 (09:40 +0200)]
Update release documentation

3 years agoUpdate actions due to deprecation of set-env and add-path
flip1995 [Fri, 9 Oct 2020 07:17:48 +0000 (09:17 +0200)]
Update actions due to deprecation of set-env and add-path

3 years agoAuto merge of #6145 - flip1995:backport_remerge, r=flip1995
bors [Fri, 9 Oct 2020 06:53:55 +0000 (06:53 +0000)]
Auto merge of #6145 - flip1995:backport_remerge, r=flip1995

Backport remerge

Step 1 in the release process.

r? `@ghost`

changelog: none

3 years agoMerge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 [Fri, 9 Oct 2020 06:52:06 +0000 (08:52 +0200)]
Merge remote-tracking branch 'upstream/beta' into backport_remerge

3 years agoAuto merge of #6133 - JPTIZ:no-box-for-c-ffi, r=ebroto
bors [Thu, 8 Oct 2020 22:50:29 +0000 (22:50 +0000)]
Auto merge of #6133 - JPTIZ:no-box-for-c-ffi, r=ebroto

clippy_lints: Do not warn against Box parameter in C FFI

changelog: [`boxed_local`]: don't lint in `extern fn` arguments

Fixes #5542.

When using C FFI, to handle pointers in parameters it is needed to
declare them as `Box` in its Rust-side signature. However, the current
linter warns against the usage of Box stating that "local variable
doesn't need to be boxed here".

This commit fixes it by ignoring functions whose Abi is C.

3 years agotests: Add test function that does not specify ABI
João Paulo Taylor Ienczak Zanette [Thu, 8 Oct 2020 21:50:52 +0000 (18:50 -0300)]
tests: Add test function that does not specify ABI

3 years agoAuto merge of #6117 - dtolnay:string_lit_as_bytes, r=ebroto
bors [Thu, 8 Oct 2020 21:33:32 +0000 (21:33 +0000)]
Auto merge of #6117 - dtolnay:string_lit_as_bytes, r=ebroto

Downgrade string_lit_as_bytes to nursery

Between #1402 (regarding `to_owned`) and #4494 (regarding `impl Read`), as well as other confusion I've seen hit in my work codebase involving string_lit_as_bytes (`"...".as_bytes().into()`), I don't think this lint is at a quality to be enabled by default.

I would consider re-enabling this lint after it is updated to understand when the surrounding type information is sufficient to unsize `b"..."` to &\[u8\] without causing a type error.

As currently implemented, this lint is pushing people to write `&b"_"[..]` which is not an improvement over `"_".as_bytes()` as far as I am concerned.

---

changelog: Remove string_lit_as_bytes from default set of enabled lints

3 years agoReplace run_compiler with RunCompiler builder pattern.
Darshan Kathiriya [Wed, 7 Oct 2020 12:09:59 +0000 (09:09 -0300)]
Replace run_compiler with RunCompiler builder pattern.
RunCompiler::new takes non-optional params, and optional
params can be set using set_*field_name* method.
finally `run` will forward all fields to `run_compiler`.

3 years agoAuto merge of #6138 - giraffate:note_that_we_follow_rustc_no_merge_policy, r=Manishearth
bors [Thu, 8 Oct 2020 16:56:14 +0000 (16:56 +0000)]
Auto merge of #6138 - giraffate:note_that_we_follow_rustc_no_merge_policy, r=Manishearth

Add note that we follow a rustc no merge-commit policy

I think it would be better to add a note that we follow a rustc no merge-commit policy. For example, it was mentioned at https://github.com/rust-lang/rust-clippy/pull/5694#issuecomment-641871096.

changelog: none

3 years agoAdd note that we follow a rustc no merge-commit policy
Takayuki Nakata [Thu, 8 Oct 2020 14:13:06 +0000 (23:13 +0900)]
Add note that we follow a rustc no merge-commit policy

3 years agoClippy dev subcommand to build and serve website
David Tolnay [Thu, 8 Oct 2020 12:18:22 +0000 (05:18 -0700)]
Clippy dev subcommand to build and serve website

3 years agoclippy_lint: extern definition is in Rust, not C
João Paulo Taylor Ienczak Zanette [Thu, 8 Oct 2020 12:07:24 +0000 (09:07 -0300)]
clippy_lint: extern definition is in Rust, not C

3 years agoclippy_lint: Fix typo (now -> not)
João Paulo Taylor Ienczak Zanette [Thu, 8 Oct 2020 12:06:19 +0000 (09:06 -0300)]
clippy_lint: Fix typo (now -> not)

3 years agoclippy_lint: Extend BoxedLocal ignored ABI to all non-rust ABIs.
João Paulo Taylor Ienczak Zanette [Thu, 8 Oct 2020 12:03:11 +0000 (09:03 -0300)]
clippy_lint: Extend BoxedLocal ignored ABI to all non-rust ABIs.

3 years agoMake clippy_lints's doc tests succeed
David Tolnay [Thu, 8 Oct 2020 11:54:17 +0000 (04:54 -0700)]
Make clippy_lints's doc tests succeed

3 years agoDocument string_lit_as_bytes known problems
David Tolnay [Thu, 8 Oct 2020 11:50:24 +0000 (04:50 -0700)]
Document string_lit_as_bytes known problems

3 years agoAuto merge of #6132 - rust-lang:regex-unicode, r=ebroto
bors [Thu, 8 Oct 2020 08:48:12 +0000 (08:48 +0000)]
Auto merge of #6132 - rust-lang:regex-unicode, r=ebroto

Fix unicode regexen with bytes::Regex

fixes #6005

The rationale for this is that since we wrote that lint, `bytes::Regex` was extended to be able to use unicode character classes.

---

changelog: [`invalid_regex`]: allow unicode character classes in bytes regex.

3 years agoclippy_lint: Test for BoxedLocal false-positive in C-FFI and fix C-FFI Abi comparison.
João Paulo Taylor Ienczak Zanette [Thu, 8 Oct 2020 01:49:50 +0000 (22:49 -0300)]
clippy_lint: Test for BoxedLocal false-positive in C-FFI and fix C-FFI Abi comparison.

3 years agoclippy_lints: Do not warn against Box parameter in C FFI
João Paulo Taylor Ienczak Zanette [Thu, 8 Oct 2020 00:41:54 +0000 (21:41 -0300)]
clippy_lints: Do not warn against Box parameter in C FFI

Fixes #5542.

When using C FFI, to handle pointers in parameters it is needed to
declare them as `Box` in its Rust-side signature. However, the current
linter warns against the usage of Box stating that "local variable
doesn't need to be boxed here".

This commit fixes it by ignoring functions whose Abi is Cdecl.

3 years agoAuto merge of #6128 - dtolnay:rc_buffer, r=yaahc
bors [Wed, 7 Oct 2020 23:10:34 +0000 (23:10 +0000)]
Auto merge of #6128 - dtolnay:rc_buffer, r=yaahc

Downgrade rc_buffer to restriction

I think Arc\<Vec\<T\>\> and Arc\<String\> and similar are a totally reasonable data structure, as observed by others in the comments on [#6044](https://github.com/rust-lang/rust-clippy/pull/6044#event-3799579830) as well. Doing `Arc::make_mut(&mut self.vec).push(...)` or `Arc::make_mut(&mut self.string).push_str("...")` is a terrific and well performing copy-on-write pattern. Linting this with an enabled-by-default <kbd>performance</kbd> lint strikes me as an unacceptable false positive balance.

As of #6090 the documentation of this lint now contains:

> **Known problems:** This pattern can be desirable ...

which should indicate that we shouldn't be linting against correct, reasonable, well-performing patterns with an enabled-by-default lint.

Mentioning #6044, #6090.
r? `@yaahc,` who reviewed the lint.

---

changelog: Remove rc_buffer from default set of enabled lints

3 years agoFix unicode regexen with bytes::Regex
Andre Bogus [Wed, 7 Oct 2020 23:07:00 +0000 (01:07 +0200)]
Fix unicode regexen with bytes::Regex

fixes #6005

3 years agofixup! New lint: Recommend using `ptr::eq` when possible
Bruno BELANYI [Wed, 7 Oct 2020 15:11:11 +0000 (17:11 +0200)]
fixup! New lint: Recommend using `ptr::eq` when possible

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agofixup! Rename tables to typecheck_result()
Bruno BELANYI [Wed, 7 Oct 2020 15:10:31 +0000 (17:10 +0200)]
fixup! Rename tables to typecheck_result()

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agoRename tables to typecheck_result()
Bruno BELANYI [Wed, 7 Oct 2020 09:59:20 +0000 (11:59 +0200)]
Rename tables to typecheck_result()

3 years agofixup! New lint: Recommend using `ptr::eq` when possible
Bruno BELANYI [Wed, 7 Oct 2020 09:54:00 +0000 (11:54 +0200)]
fixup! New lint: Recommend using `ptr::eq` when possible

Add missing modified files.

3 years agoNew lint: Recommend using `ptr::eq` when possible
Bruno BELANYI [Wed, 7 Oct 2020 09:37:32 +0000 (11:37 +0200)]
New lint: Recommend using `ptr::eq` when possible

This is based almost entirely on the code available in the previous PR #4596.

3 years agoAuto merge of #6120 - phansch:replace-lazy-static, r=Manishearth
bors [Wed, 7 Oct 2020 04:58:13 +0000 (04:58 +0000)]
Auto merge of #6120 - phansch:replace-lazy-static, r=Manishearth

Replace some lazy_static usage with once_cell feature

This replaces some `lazy_static` usage with [`SyncLazy`](https://doc.rust-lang.org/nightly/std/lazy/struct.SyncLazy.html) of the unstable `once_cell` feature.

changelog: none

3 years agoDowngrade rc_buffer to restriction
David Tolnay [Wed, 7 Oct 2020 02:46:03 +0000 (19:46 -0700)]
Downgrade rc_buffer to restriction

3 years agoDowngrade string_lit_as_bytes to nursery
David Tolnay [Mon, 5 Oct 2020 19:19:35 +0000 (12:19 -0700)]
Downgrade string_lit_as_bytes to nursery

3 years agoAuto merge of #6124 - pickfire:patch-1, r=flip1995
bors [Tue, 6 Oct 2020 23:22:28 +0000 (23:22 +0000)]
Auto merge of #6124 - pickfire:patch-1, r=flip1995

Use more concrete explanation for methods

*Please keep the line below*
changelog: none

3 years agoAuto merge of #6127 - ebroto:reinstate_forbid_restriction, r=flip1995
bors [Tue, 6 Oct 2020 22:33:57 +0000 (22:33 +0000)]
Auto merge of #6127 - ebroto:reinstate_forbid_restriction, r=flip1995

Reinstate test for forbid(clippy::restriction)

In [this commit](https://github.com/rust-lang/rust-clippy/pull/6126/commits/5747c15961da9d2d0b0dd775174d39f3b5961597) coming from rust-lang/rust (#6126) the test for `#![forbid(clippy::restriction)]` was removed because some restriction lints were being allowed after the forbid.

This change reinstates the test for `forbid` by using a separate file.

changelog: none

r? `@flip1995`

3 years agoReinstate test for forbid blanket restriction
Eduardo Broto [Tue, 6 Oct 2020 22:02:28 +0000 (00:02 +0200)]
Reinstate test for forbid blanket restriction

3 years agoAuto merge of #6126 - flip1995:rustup, r=flip1995
bors [Tue, 6 Oct 2020 21:34:50 +0000 (21:34 +0000)]
Auto merge of #6126 - flip1995:rustup, r=flip1995

Rustup

Supersedes #6121. There was another breakage.

r? `@ghost`

changelog: none

3 years agoRun fmt
flip1995 [Tue, 6 Oct 2020 21:32:38 +0000 (23:32 +0200)]
Run fmt

3 years agoUse more concrete explanation for methods
Ivan Tham [Tue, 6 Oct 2020 15:58:32 +0000 (23:58 +0800)]
Use more concrete explanation for methods

Show some code rather than "a single method call".

3 years agoclippy_lints: Replace lazy_static with SyncLazy
Philipp Hansch [Tue, 6 Oct 2020 06:26:16 +0000 (08:26 +0200)]
clippy_lints: Replace lazy_static with SyncLazy

3 years agoFix tools
Matthew Jasper [Tue, 30 Jun 2020 21:41:57 +0000 (22:41 +0100)]
Fix tools

3 years agoRollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
Yuki Okushi [Tue, 6 Oct 2020 07:26:11 +0000 (16:26 +0900)]
Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr

Fix LitKind's byte buffer to use refcounted slice

While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type.

This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).

3 years agoRollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in...
Yuki Okushi [Tue, 6 Oct 2020 07:26:04 +0000 (16:26 +0900)]
Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov

Disallow overriding forbid in same scope

Rebased #73379.

Fixes #70819.