Commit graph

16748 commits

Author SHA1 Message Date
disco07
d2bbe76008 redundant_pattern_matching 2023-05-05 21:49:55 +02:00
disco07
afa2741e6a redundant_pattern_matching 2023-05-05 21:33:16 +02:00
bors
371120bdbf Auto merge of #10749 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-05-05 15:30:22 +00:00
Philipp Krones
79656cc95e
Bump nightly version -> 2023-05-05 2023-05-05 17:29:40 +02:00
Philipp Krones
88c7632659
Merge remote-tracking branch 'upstream/master' into rustup 2023-05-05 17:29:35 +02:00
bors
d7173e2599 Auto merge of #10747 - Alexendoo:cargo-dev-dogfood-stdout, r=flip1995
Inherit stdout/stderr for `cargo dev dogfood`

changelog: none

Prints progress as it happens and in colour, and will also show anything printed to stderr
2023-05-05 12:22:25 +00:00
Alex Macleod
0f7b61d729 Inherit stdout/stderr for cargo dev dogfood 2023-05-05 12:10:36 +00:00
bors
8518391e72 Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr
Replace `tcx.mk_trait_ref` with `TraitRef::new`

First step in implementing https://github.com/rust-lang/compiler-team/issues/616
r? `@lcnr`
2023-05-04 05:54:09 +00:00
bors
f9c1d155b4 Auto merge of #10716 - Icxolu:unitstruct_default_construction, r=Manishearth
Fixes #10609: Adds lint to detect construction of unit struct using `default`

Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name.

changelog: [`default_constructed_unit_structs`]: detects construction of unit structs using `default`

fixes #10609
2023-05-03 21:43:02 +00:00
Icxolu
48ae5a071b fix lint docs 2023-05-03 21:43:10 +02:00
Icxolu
160371550f add rustfix annotation 2023-05-03 21:05:50 +02:00
Icxolu
4ed7fd1ecc fix failing tests 2023-05-03 20:55:14 +02:00
Icxolu
8701009860 add more test cases 2023-05-03 20:55:14 +02:00
Icxolu
4e04903631 rename to plural form 2023-05-03 19:25:25 +02:00
bors
c2e0d43485 Auto merge of #10734 - smoelius:patch-2, r=Alexendoo
Update macros.rs (typo)

r? `@Alexendoo`

changelog: none
2023-05-03 10:34:39 +00:00
bors
9353170dfb Auto merge of #10730 - blyxyas:no_std_mul_add, r=Jarcho
`imprecise_flops`: Globally ignore `#[no_std]` crates

Really small fix.
Fixes #10728
changelog: [`imprecise_flops`]: Fix false positives with `#[no_std]`
2023-05-03 01:47:52 +00:00
Samuel Moelius
7e24ff33e4
Update macros.rs 2023-05-02 19:02:06 -04:00
Nicholas Nethercote
431cce1540 Restrict From<S> for {D,Subd}iagnosticMessage.
Currently a `{D,Subd}iagnosticMessage` can be created from any type that
impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static,
str>`, which are reasonable. It also includes `&String`, which is pretty
weird, and results in many places making unnecessary allocations for
patterns like this:
```
self.fatal(&format!(...))
```
This creates a string with `format!`, takes a reference, passes the
reference to `fatal`, which does an `into()`, which clones the
reference, doing a second allocation. Two allocations for a single
string, bleh.

This commit changes the `From` impls so that you can only create a
`{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static,
str>`. This requires changing all the places that currently create one
from a `&String`. Most of these are of the `&format!(...)` form
described above; each one removes an unnecessary static `&`, plus an
allocation when executed. There are also a few places where the existing
use of `&String` was more reasonable; these now just use `clone()` at
the call site.

As well as making the code nicer and more efficient, this is a step
towards possibly using `Cow<'static, str>` in
`{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing
the `From<&'a str>` impls to `From<&'static str>`, which is doable, but
I'm not yet sure if it's worthwhile.
2023-05-03 08:44:39 +10:00
blyxyas
0dd2501e0d
Don't ignore check_radians 2023-05-02 20:47:18 +02:00
bors
d36bde7db0 Auto merge of #109128 - chenyukang:yukang/remove-type-ascription, r=estebank
Remove type ascription from parser and diagnostics

Mostly based on https://github.com/rust-lang/rust/pull/106826

Part of #101728

r? `@estebank`
2023-05-02 09:41:35 +00:00
Dylan DPC
eac589b4e4 Rollup merge of #110955 - fee1-dead-contrib:sus-operation, r=compiler-errors
uplift `clippy::clone_double_ref` as `suspicious_double_ref_op`

Split from #109842.

r? ``@compiler-errors``
2023-05-02 11:44:52 +05:30
bors
824f2e701c Auto merge of #10724 - lukaslueg:largeerrdocs, r=giraffate
Clarify docs for `RESULT_LARGE_ERR`

Adds a paragraph to address https://github.com/rust-lang/rust-clippy/issues/10211#issuecomment-1521548238

changelog: [`result_large_err`]: Update the document
2023-05-02 00:41:36 +00:00
Icxolu
220a9db642 fixed span and corrected test output 2023-05-01 20:12:34 +02:00
bors
8354b34061 Auto merge of #111036 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-05-01 11:13:49 +00:00
blyxyas
5749054241
globally ignore #[no_std] crates 2023-05-01 12:39:20 +02:00
yukang
d4baabe902 clean up Colon from clippy 2023-05-01 16:15:17 +08:00
Ralf Jung
de4bc66f94 Merge from rustc 2023-04-30 22:35:29 +02:00
Icxolu
032bc11fd4
fix diagnostic message style
Co-authored-by: Ruby Lazuli <general@patchmixolydic.com>
2023-04-29 21:11:34 +02:00
bors
7bc3da975a Auto merge of #10647 - y21:while_pop_unwrap, r=llogiq
new lint: `manual_while_let_some`

This PR implements the lint I suggested [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/lint.20on.20while.20pop.20unwrap).
It looks for while loops like these:
```rs
let mut numbers = vec![0, 1, 2];
while !numbers.is_empty() {
  let number = numbers.pop().unwrap();
  // use `number`
}
```
and suggests replacing it with a while-let loop, like this:
```rs
let mut numbers = vec![0, 1, 2];
while let Some(number) = numbers.pop() {
  // use `number`
}
```
... which is more concise and idiomatic.

It only looks for `Vec::pop()` calls in the first statement of the loop body in an attempt to not trigger FPs (as pop might only be called conditionally).

changelog: new lint [`manual_while_let_some`]
2023-04-29 17:57:25 +00:00
y21
9613ea85c6 fix run-rustfix directive 2023-04-29 19:10:52 +02:00
y21
8d8178f931 rename lint to manual_while_let_some 2023-04-29 18:59:07 +02:00
y21
f10e39fd2b make PopStmt copy+clone 2023-04-29 18:59:07 +02:00
y21
ab9b7a5ad2 remove unnecessary reference 2023-04-29 18:59:07 +02:00
y21
1d08325293 move lint to loops, emit proper suggestion, more tests 2023-04-29 18:59:07 +02:00
y21
bcdcc34ba9 elide lifetimes, get rid of glob import 2023-04-29 18:59:06 +02:00
y21
bb58083ce5 new lint: while_pop_unwrap 2023-04-29 18:59:06 +02:00
Lukas Lueg
2ed254e29f Clarify docs for RESULT_LARGE_ERR 2023-04-29 14:18:31 +02:00
bors
3594d55439 Auto merge of #10719 - blyxyas:fix-items_after_test_mod_imported_modules, r=Alexendoo
Fix `items_after_test_module`: Ignore imported modules

Fixes #10713. It does a little bit of dark magic, but intention is what really counts.
changelog:[`items_after_test_module`]: Ignore imported modules (`mod foo;`) with no body.
2023-04-28 18:42:58 +00:00
blyxyas
395b1f5bf3
Rename items + Delete imported_module.stderr 2023-04-28 20:40:47 +02:00
blyxyas
2b5820d58b
Change module import system 2023-04-28 20:23:05 +02:00
blyxyas
f37054b396
Remove useless span magic 2023-04-28 20:19:36 +02:00
Deadbeef
81a614145f uplift clippy::clone_double_ref as suspicious_double_ref_op 2023-04-28 17:24:48 +00:00
bors
b7939f4d6c Auto merge of #10720 - SergenKaraoglan:personal, r=flip1995
run linkcheck in clippy ci

fixes #10711

changelog: Run [linkcheck.sh](https://github.com/rust-lang/rust/blob/master/src/tools/linkchecker/linkcheck.sh) from rustc repo in Remark.yml to check Clippy book.
2023-04-28 14:21:48 +00:00
Sergen Karaoglan
d1f55e6b53 run linkcheck in Remark CI
fix new lints link

install nightly rust-docs

run linkcheck without nightly toolchain

remove nightly toolchain, add rust-docs component

Test Remark

Update basics.md

Update basics.md

Update basics.md

update workflow

add rust docs toolchain

Update remark.yml

workflow test

manual test

update book path

add linkcheck book to CI

Update lint_passes.md
2023-04-28 15:11:48 +01:00
Ralf Jung
19b3b22a27 Merge from rustc 2023-04-28 15:49:39 +02:00
Michael Goulet
83504fa763 Make clippy happy 2023-04-27 17:18:12 +00:00
blyxyas
273c898aef
Fix #10713 and move the tests to a subdir 2023-04-27 16:43:51 +02:00
Boxy
0339d4e982 rename needs_infer to has_infer 2023-04-27 08:35:19 +01:00
Icxolu
9428138562 adds lint to detect construction of unit struct using default
Using `default` to construct a unit struct increases code complexity and
adds a function call. This can be avoided by simply removing the call to
`default` and simply construct by name.
2023-04-26 21:12:59 +02:00
Maybe Waffle
95648951ea Fix uses of TraitRef::identity in clippy and rustdoc 2023-04-26 13:48:56 +00:00