Commit Graph

139204 Commits

Author SHA1 Message Date
Samuel E. Moelius III
8047458f40 Move conf.rs back into clippy_lints 2021-02-24 06:21:46 -05:00
bors
489c4f00f9 Auto merge of #6756 - smoelius:clippy_utils, r=flip1995,obi-obk
Factor out `clippy_utils` crate

As discussed in https://github.com/rust-lang/rust-clippy/pull/6746, this PR factors out `clippy_lints::utils` as its own crate, `clippy_utils` .

This change will allow `clippy_utils` to be used in lints outside of Clippy.

There is no plan to publish this crate on `crates.io` (see https://github.com/rust-lang/rust-clippy/pull/6746#issuecomment-780747522). Dependent crates should obtain it from GitHub.

changelog: Factor out `clippy_utils` so it can be used by external tools (not published)
2021-02-24 09:43:23 +00:00
bors
045d3f34f8 Auto merge of #6782 - ojeda:readme-as-wrapper, r=flip1995
README: Add subsection on running Clippy as a rustc wrapper

This is useful for projects that do not use cargo.

changelog: README: Add subsection on running Clippy as a rustc wrapper
2021-02-24 09:31:26 +00:00
Guillaume Gomez
cc0d531463 Make DocContext &mut for clean 2021-02-24 10:16:33 +01:00
Guillaume Gomez
f24eac5e64 Prevent to compute Item attributes twice 2021-02-24 10:05:19 +01:00
Ömer Sinan Ağacan
9c5f684e83 Turn Pick field comments into documentation 2021-02-24 10:37:53 +03:00
bors
6b56603e35 Auto merge of #80475 - simonvandel:fix-77355, r=oli-obk
New mir-opt pass to simplify gotos with const values (reopening #77486)

Reopening PR #77486

Fixes #77355

This pass optimizes the following sequence
```rust
bb2: {
    _2 = const true;
    goto -> bb3;
}

bb3: {
    switchInt(_2) -> [false: bb4, otherwise: bb5];
}
```
into
```rust
bb2: {
    _2 = const true;
    goto -> bb5;
}
```
2021-02-24 07:23:54 +00:00
Amanieu d'Antras
00eca69bff Properly reject non-const arguments 2021-02-24 06:46:30 +00:00
Ömer Sinan Ağacan
5ac6935974 Move pick_by_value_method docs above function header
- Currently style triggers #81183 so we can't add `#[instrument]` to
  this function.

- Having docs above the header is more consistent with the rest of the
  code base.
2021-02-24 09:36:10 +03:00
Miguel Ojeda
eefec8abda library: Normalize safety-for-unsafe-block comments
Almost all safety comments are of the form `// SAFETY:`,
so normalize the rest and fix a few of them that should
have been a `/// # Safety` section instead.

Furthermore, make `tidy` only allow the uppercase form. While
currently `tidy` only checks `core`, it is a good idea to prevent
`core` from drifting to non-uppercase comments, so that later
we can start checking `alloc` etc. too.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-24 06:13:42 +01:00
Camelid
a03950bc88 rustdoc: Name fields of ResolutionFailure::WrongNamespace
It makes it clearer that the `Namespace` is the one requested by the
disambiguator, rather than the actual namespace of the item. It said
that in the docs before, but now you can tell in the code so it reduces
the potential for confusion.
2021-02-23 20:58:08 -08:00
Eric Huss
476c6c27e7 Update outdated comment in unix Command. 2021-02-23 20:19:15 -08:00
Jeff Muizelaar
010a6f9556 panic_bounds_checks should be panic_bounds_check 2021-02-23 22:29:47 -05:00
bors
301ad8a4fa Auto merge of #80891 - cjgillot:noq, r=Mark-Simulacrum
Make the `Query` enum a simple struct.

A lot of code in `rustc_query_system` is generic over it, only to encode an exceptional error case: query cycles.
The delayed computations are now done at cycle detection.
2021-02-24 03:29:00 +00:00
Amanieu d'Antras
69cde44390 TODO -> FIXME 2021-02-24 02:36:45 +00:00
Miguel Ojeda
6b8b43c0d1 README: Add subsection on running Clippy as a rustc wrapper
This is useful for projects that do not use cargo.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-24 01:54:42 +01:00
Tomasz Miąsko
55626eda08 Use log level to control partitioning debug output 2021-02-24 00:00:00 +00:00
Tomasz Miąsko
ef731b31db Use small hash set in mir_inliner_callees
Use small hash set in `mir_inliner_callees` to avoid temporary
allocation when possible and quadratic behaviour for large number of
callees.
2021-02-24 00:00:00 +00:00
Tomasz Miąsko
6d5c0c1bcb Consider inexpensive inlining criteria first
Refactor inlining decisions so that inexpensive criteria are considered first:

1. Based on code generation attributes.
2. Based on MIR availability (examines call graph).
3. Based on MIR body.
2021-02-24 00:00:00 +00:00
Samuel E. Moelius III
ab7381f085 Move declare_clippy_lint back into clippy_lints 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
c7869b82a2 Update references in doc directory 2021-02-23 18:50:30 -05:00
Samuel E. Moelius
33ee598a9f Update clippy_utils/Cargo.toml
Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
8500ad5d19 Typo 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
50e3ef9eb5 Remove file accidentally re-added during rebase 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
2c26c0f621 Update custom_ice_message.stderr 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
ce76fb3d09 Fix update_lints 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
979206f6b4 Fix doc test 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
964f2a0ef2 Bump clippy_utils version 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
1e7b1ccb2a Fix versioncheck test 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
5f04b50191 Fix one import 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
ff157ae1f4 Improve tests 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
b7f03c6697 Remove unused features 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
29b6570612 Remove unused dependencies 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
523de296cc Get tests to pass 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
c5b9d22b02 Update clippy_utils/src/lib.rs 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
8d2de8f256 Update clippy_lints/src/lib.rs 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
09bded4437 Factor out clippy_utils crate 2021-02-23 18:50:30 -05:00
klensy
c75c4a579b replaced some map_or with map_or_else 2021-02-24 02:43:35 +03:00
Ellen
42cbfd6346 yeet 2021-02-23 23:35:59 +00:00
bors
a2c25fa9f0 Auto merge of #6573 - Jarcho:option_match_map, r=llogiq
New lint: option_manual_map

fixes: #6
changelog: Added lint: `match_map`
2021-02-23 21:56:25 +00:00
Guillaume Gomez
33aaead6a1 Improve code readability 2021-02-23 22:13:48 +01:00
Guillaume Gomez
3c59e64abf * Fix some typo
* Improve documentation
* Add a test to ensure that spotlighted traits from dependencies are taken into account as expected
2021-02-23 21:58:17 +01:00
Guillaume Gomez
b5c8eea55d Put clean::Trait extra information into a new struct to make it more coherent 2021-02-23 21:58:16 +01:00
Guillaume Gomez
fa51c0f472 Use a qualified path to make it more clear where list_contains_name function comes from 2021-02-23 21:57:42 +01:00
Guillaume Gomez
58a34a4dde Remove is_spotlight field from Trait 2021-02-23 21:57:40 +01:00
klensy
5ff1be197e replaced some unwrap_or with unwrap_or_else 2021-02-23 23:56:04 +03:00
Michael Howell
de6f1b8278 Do not consider using a semicolon inside of a different-crate macro
Fixes #81943
2021-02-23 12:03:44 -07:00
Amanieu d'Antras
e604d01fed Move tests to subdirectory 2021-02-23 17:38:34 +00:00
Amanieu d'Antras
d87eec1bf6 Add #[rustc_legacy_const_generics] 2021-02-23 17:25:55 +00:00
bors
fe1bf8e05c Auto merge of #82443 - Dylan-DPC:rollup-yni7uio, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #81629 (Point out implicit deref coercions in borrow)
 - #82113 (Improve non_fmt_panic lint.)
 - #82258 (Implement -Z hir-stats for nested foreign items)
 - #82296 (Support `pub` on `macro_rules`)
 - #82297 (Consider auto derefs before warning about write only fields)
 - #82305 (Remove many RefCells from DocContext)
 - #82308 (Lower condition of `if` expression before it's "then" block)
 - #82311 (Jsondocck improvements)
 - #82362 (Fix mir-cfg dumps)
 - #82391 (disable atomic_max/min tests in Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-23 17:24:33 +00:00