Commit Graph

139037 Commits

Author SHA1 Message Date
Amanieu d'Antras
cccd77955b Fix tests 2021-02-25 00:37:42 +00:00
bors
63bacf14cd Auto merge of #82162 - cuviper:flat-fold, r=Mark-Simulacrum
Expand FlattenCompat folds

The former `chain`+`chain`+`fold` implementation looked nice from a
functional-programming perspective, but it introduced unnecessary layers
of abstraction on every `flat_map`/`flatten` fold. It's straightforward
to just fold each part in turn, and this makes it look like a simplified
version of the existing `try_fold` implementation.

For the `iter::bench_flat_map*` benchmarks, I get a large improvement in
`bench_flat_map_chain_sum`, from 1,598,473 ns/iter to 499,889 ns/iter,
and the rest are unchanged.
2021-02-25 00:36:05 +00:00
bors
76a689d8c2 Auto merge of #6783 - avitex:add-opendns-ident, r=giraffate
Add OpenDNS to `doc-valid-idents`

changelog: This commit adds `"OpenDNS"` to doc-valid-idents to avoid `doc_markdown` false positives.
2021-02-25 00:22:39 +00:00
Amanieu d'Antras
2451f124c9 Address review comments 2021-02-25 00:09:33 +00:00
katelyn martin
f06896ca7a
fix typo in pre-commit.sh 2021-02-24 18:37:13 -05:00
Esteban Küber
e655941241 Account for associated consts in the "unstable assoc item name colission" lint
Fix #81663.
2021-02-24 15:35:16 -08:00
Joshua Nelson
97ab01219c Only look for tidy when running rustdoc tests
This avoids printing lots of unnecessary errors, as well as making the
test suite slightly faster.
2021-02-24 18:14:43 -05:00
Matthias Krüger
913c71018c upper_case_acronyms: add io-toml tests and bless previous tests 2021-02-24 23:50:55 +01:00
Matthias Krüger
59750dceb8 upper_case_acronyms: add optional aggressive mode and relax default
Moves the lint back from pedantic to style group.
The lint default now only warns on names that are completely capitalized, like "WORD"
and only if the name is longer than 2 chars (so that names where each of the letter represents a word are still distinguishable).
For example: FP (false positive) would still be "valid" and not warned about (but EOF would warn).

A "upper_case_acronyms_aggressive: true/false" config option was added that restores the original lint behaviour to warn
on any kind of camel case name that had more than one capital letter following another capital letter.
2021-02-24 23:50:53 +01:00
avitex
b0d18e93d6
add test coverage for all doc-valid-idents 2021-02-25 09:30:33 +11:00
avitex
72e3335684
Add OpenDNS to doc-valid-idents 2021-02-25 09:30:33 +11:00
bors
1fdadbf13a Auto merge of #82159 - BoxyUwU:uwu, r=varkor
Use correct param_env in conservative_is_privately_uninhabited

cc `@lcnr`
r? `@varkor` since this is your FIXME that was removed ^^
2021-02-24 21:54:52 +00:00
Dániel Buga
d3f75ebf60 Add test 2021-02-24 18:14:31 +01:00
Dániel Buga
3be69b100f Remove duplicate string 2021-02-24 17:44:37 +01:00
bors
454515040a Auto merge of #6786 - smoelius:move-conf-rs-back-into-clippy-lints, r=flip1995
Move conf.rs back into clippy_lints

This is an alternative solution to #6785 to fix the CI break caused by #6756.

changelog: none
2021-02-24 14:51:14 +00:00
bors
a8486b64b0 Auto merge of #80914 - GuillaumeGomez:remove-is_spotlight, r=jyn514
Remove is_spotlight field from `Trait`

Small PR, only the last commit is relevant here. The rest is coming from #80883 because I need the `TyCtxt` stored inside `Cache`.

The point is to make ItemKind looks as close as possible to the compiler type so that it makes the switch simpler (which is why I make all these "small" PRs).

r? `@jyn514`
2021-02-24 14:46:18 +00:00
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
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