Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #101246

Closed
wants to merge 188 commits into from
Closed

Commits on Aug 2, 2022

  1. Compare where predicates to trait bounds.

    - only compare where predicates to trait bounds when generating where
      clause specific message to fix rust-lang#9151
    - use comparable_trait_ref to account for trait bound generics to fix rust-lang#8757
    aldhsu authored and Allen Hsu committed Aug 2, 2022
    Configuration menu
    Copy the full SHA
    171d082 View commit details
    Browse the repository at this point in the history
  2. Split unfixable lints.

    aldhsu authored and Allen Hsu committed Aug 2, 2022
    Configuration menu
    Copy the full SHA
    b96842d View commit details
    Browse the repository at this point in the history
  3. Add extra test cases from rust-lang#8771, rust-lang#8757, rust-lang#9076

    .
    aldhsu authored and Allen Hsu committed Aug 2, 2022
    Configuration menu
    Copy the full SHA
    3ddc04f View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2022

  1. Don't lint transmute_undefined_repr when the the first field of a `…

    …repr(C)` type is compatible with the other type
    Jarcho committed Aug 3, 2022
    Configuration menu
    Copy the full SHA
    b426bd5 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2022

  1. Configuration menu
    Copy the full SHA
    80f0f28 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2022

  1. Configuration menu
    Copy the full SHA
    99e77d0 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2022

  1. Configuration menu
    Copy the full SHA
    73cd954 View commit details
    Browse the repository at this point in the history
  2. Fix the lint in clippy itself

    sgued committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    332e031 View commit details
    Browse the repository at this point in the history
  3. Move iter_once and iter_empty to methods as a late pass

    This enables more thorough checking of types to avoid triggering on
    custom Some and None enum variants
    sgued committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    f3f86d8 View commit details
    Browse the repository at this point in the history
  4. Improve suggestions

    sgued committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    f30d7c2 View commit details
    Browse the repository at this point in the history
  5. Prevent some false positives

    sgued committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    b247594 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    af4885c View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2022

  1. Configuration menu
    Copy the full SHA
    9ffddf5 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2022

  1. Configuration menu
    Copy the full SHA
    cf3f71d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6a73a45 View commit details
    Browse the repository at this point in the history
  3. Add labels to if_let_mutex

    lukaslueg committed Aug 10, 2022
    Configuration menu
    Copy the full SHA
    0428f0d View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2022

  1. Simplify rustc_ast::visit::Visitor::visit_poly_trait_ref.

    It is passed an argument that is never used.
    nnethercote committed Aug 11, 2022
    Configuration menu
    Copy the full SHA
    eb68895 View commit details
    Browse the repository at this point in the history
  2. fix

    tamaroning committed Aug 11, 2022
    Configuration menu
    Copy the full SHA
    459821b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    45084ee View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dc29cfb View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#100392 - nnethercote:simplify-visitors, r=c…

    …jgillot
    
    Simplify visitors
    
    By removing some unused arguments.
    
    r? `@cjgillot`
    matthiaskrgr committed Aug 11, 2022
    Configuration menu
    Copy the full SHA
    4d8b6d4 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2022

  1. Auto merge of rust-lang#100419 - flip1995:clippyup, r=Manishearth

    Update Clippy
    
    r? `@Manishearth`
    bors committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    9ac237d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f7f60b8 View commit details
    Browse the repository at this point in the history
  3. Lint trait duplication in one pass.

    Allen Hsu committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    8bae517 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3c4aec5 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#9289 - mkrasnitski:9094, r=xFrednet

    Extend `if_then_some_else_none` to also suggest `bool::then_some`
    
    Closes rust-lang#9094.
    
    changelog: Extend `if_then_some_else_none` to also suggest `bool::then_some`
    bors committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    05fc1c7 View commit details
    Browse the repository at this point in the history
  6. Adjust cfgs

    Mark-Simulacrum committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    1a3192a View commit details
    Browse the repository at this point in the history
  7. Update Changelog to 1.63

    flip1995 committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    35486cb View commit details
    Browse the repository at this point in the history
  8. Auto merge of rust-lang#9324 - flip1995:changelog, r=xFrednet

    1.63 Changelog
    
    r? `@xFrednet`
    
    changelog: none
    
    [Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)
    bors committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    dfa780e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f18cd27 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2022

  1. Auto merge of rust-lang#9326 - flip1995:version-update, r=xFrednet

    Update lint versions for 1.63 release
    
    r? `@xFrednet`
    
    changelog: none
    bors committed Aug 13, 2022
    Configuration menu
    Copy the full SHA
    4d5d191 View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2022

  1. Auto merge of rust-lang#9167 - aldhsu:fix-trait-duplication-false-pos…

    …, r=flip1995
    
    Fixes [`trait_duplication_in_bounds`] false positives
    
    Fixes rust-lang#9076 rust-lang#9151 rust-lang#8757.
    Partially fixes rust-lang#8771.
    
    changelog: [`trait_duplication_in_bounds`]: Reduce number of false positives.
    bors committed Aug 14, 2022
    Configuration menu
    Copy the full SHA
    84df61c View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#9187 - sgued:iter-once, r=flip1995

    Add lint recommending using `std::iter::once` and `std::iter::empty`
    
    ```
    changelog: [`iter_once`]: add new lint
    changelog: [`iter_empty`]: add new lint
    ```
    
    fixes rust-lang#9186
    
    - \[ ] 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
    
    The lint doesn't really follow the naming conventions. I don't have any better idea so I'm open to suggestions.
    bors committed Aug 14, 2022
    Configuration menu
    Copy the full SHA
    679fa9f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    80826c3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1bf8841 View commit details
    Browse the repository at this point in the history
  5. Skip unnecessary_to_owned when t != t.to_string()

    Signed-off-by: xphoniex <dj.2dixx@gmail.com>
    xphoniex committed Aug 14, 2022
    Configuration menu
    Copy the full SHA
    1a2aaf6 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2022

  1. Auto merge of rust-lang#96745 - ehuss:even-more-attribute-validation,…

    … r=cjgillot
    
    Visit attributes in more places.
    
    This adds 3 loosely related changes (I can split PRs if desired):
    
    - Attribute checking on pattern struct fields.
    - Attribute checking on struct expression fields.
    - Lint level visiting on pattern struct fields, struct expression fields, and generic parameters.
    
    There are still some lints which ignore lint levels in various positions. This is a consequence of how the lints themselves are implemented. For example, lint levels on associated consts don't work with `unused_braces`.
    bors committed Aug 15, 2022
    Configuration menu
    Copy the full SHA
    86a0a18 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#9329 - xphoniex:fix-rust-lang#9317, r=flip1995

    Skip `unnecessary_to_owned` when `t != t.to_string()`
    
    Fixes rust-lang#9317
    
    changelog: [`unnecessary_to_owned`]: none
    bors committed Aug 15, 2022
    Configuration menu
    Copy the full SHA
    8c9040c View commit details
    Browse the repository at this point in the history
  3. Fix label not starting with lcase-letter

    Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
    lukaslueg and xFrednet committed Aug 15, 2022
    Configuration menu
    Copy the full SHA
    6de4bdf View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7727c30 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#9318 - lukaslueg:ifletmutexref, r=xFrednet

    Fix if_let_mutex not checking Mutexes behind refs
    
    Fixes rust-lang#9193
    
    We can always peel references because we are looking for a method-call, for which autoderef applies.
    
    ---
    
    changelog: [`if_let_mutex`]: detect calls to `Mutex::lock()` if mutex is behind a ref
    changelog: [`if_let_mutex`]: Add labels to the two instances of the same Mutex that will deadlock
    bors committed Aug 15, 2022
    Configuration menu
    Copy the full SHA
    0fc95e8 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2022

  1. Auto merge of rust-lang#9328 - stanislav-tkach:borrow_deref_ref-remov…

    …e-extra-deref-from-example, r=giraffate
    
    Remove extra dereference from the borrow_deref_ref lint example
    
    I don't think such minor change should be mentioned in the changelog.
    
    changelog: none
    bors committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    a427b12 View commit details
    Browse the repository at this point in the history
  2. Shrink ast::Attribute.

    nnethercote committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    6e5f90a View commit details
    Browse the repository at this point in the history
  3. Rename some things related to literals.

    - Rename `ast::Lit::token` as `ast::Lit::token_lit`, because its type is
      `token::Lit`, which is not a token. (This has been confusing me for a
      long time.)
      reasonable because we have an `ast::token::Lit` inside an `ast::Lit`.
    - Rename `LitKind::{from,to}_lit_token` as
      `LitKind::{from,to}_token_lit`, to match the above change and
      `token::Lit`.
    nnethercote committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    e92183c View commit details
    Browse the repository at this point in the history
  4. Fix example

    alex-semenyuk committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    9e9b3dd View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#9040 - miam-miam100:unused_named_parameter, r…

    …=dswij
    
    Add new lint [`positional_named_format_parameters`]
    
    *Please write a short comment explaining your change (or "none" for internal only changes)*
    
    changelog: Add new lint [`positional_named_format_parameters`] to warn when named parameters in format strings are used as positional arguments.
    bors committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    86ac6e8 View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#9340 - alex-semenyuk:box_t, r=dswij

    Fix example
    
    The example didn't show the actual problem [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9d0e0727ca5bbd854767f50da693ca0f)
    changelog: none
    bors committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    048e4d0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c1e0435 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    bd121ef View commit details
    Browse the repository at this point in the history
  9. suggest map_or in case_sensitive_file_extension_comparisons

    Currently, case_sensitive_file_extension_comparisons suggests using
    `map(..).unwrap_or(..)` which trips up `map_unwrap_or`.  This updates
    the suggestion to use map_or.
    Brian Caswell committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    bfeaae8 View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#9327 - Serial-ATA:non_ascii_literal_macro, r=…

    …Alexendoo
    
    Fix [`non_ascii_literal`] in tests
    
    changelog: Don't lint [`non_ascii_literal`] when using non-ascii comments in tests
    changelog: Don't lint [`non_ascii_literal`] when `allow`ed on tests
    
    closes: rust-lang#7739
    closes: rust-lang#8263
    bors committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    f4f5bb4 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    343476d View commit details
    Browse the repository at this point in the history
  12. Auto merge of rust-lang#9343 - Serial-ATA:compiletest-target-env, r=M…

    …anishearth
    
    Use `CARGO_TARGET_DIR` in compile-test
    
    changelog: none
    
    I have a global `CARGO_TARGET_DIR` set, but forgot to delete the old target dir. `compile-test` was getting tripped up on an outdated `rustfix_missing_coverage.txt` I had in there, keeping me from running tests 😄.
    bors committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    a331766 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    a05cb74 View commit details
    Browse the repository at this point in the history
  14. Fix adjacent code

    smoelius committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    032f112 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2022

  1. Auto merge of rust-lang#9341 - bmc-msft:suggest-map_or-instead-of-unw…

    …rap_or, r=giraffate
    
    suggest map_or in case_sensitive_file_extension_comparisons
    
    changelog: [`case_sensitive_file_extension_comparisons `]: updated suggestion in the example to use `map_or`
    
    Currently, case_sensitive_file_extension_comparisons suggests using `map(..).unwrap_or(..)` which trips up the `map_unwrap_or` lint.  This updates the suggestion to use `map_or`.
    bors committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    18c6818 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    48cb816 View commit details
    Browse the repository at this point in the history
  3. Fix typo in as_undescore docs

    du -> due
    cherryblossom000 committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    aadd014 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#9344 - Jarcho:opt_target_dir, r=flip1995

    Handle `CARGO_TARGET_DIR` not being set in compile-test
    
    changelog: None
    bors committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    4235b64 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#9345 - cherryblossom000:patch-1, r=flip1995

    Fix typo in as_undescore docs
    
    *Please write a short comment explaining your change (or "none" for internal only changes)*
    
    changelog: none
    bors committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    dc497c8 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#100018 - nnethercote:clean-up-LitKind, r=pe…

    …trochenkov
    
    Clean up `LitKind`
    
    r? ``@petrochenkov``
    matthiaskrgr committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    37eeed7 View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#9287 - Jarcho:trans_undefined, r=xFrednet

    `transmute_undefined_repr` fix
    
    changelog: Don't lint `transmute_undefined_repr` when the the first field of a `repr(C)` type is compatible with the other type
    bors committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    84fb7e0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ab91d5a View commit details
    Browse the repository at this point in the history
  9. Auto merge of rust-lang#9338 - sgued:9331-unwrap-err-used, r=giraffate

    unwrap_used and expect_used: trigger on uses of their _err variants
    
    changelog: [`unwrap_used`]: lint uses of `unwrap_err`
    changelog: [`expect_used`]: lint uses of `expect_err`
    
    fixes rust-lang#9331
    bors committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    849c1c0 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2022

  1. Auto merge of rust-lang#9136 - smoelius:enhance-needless-borrow, r=Ja…

    …rcho
    
    Enhance `needless_borrow` to consider trait implementations
    
    The proposed enhancement causes `needless_borrow` to suggest removing `&` from `&e` when `&e` is an argument position requiring trait implementations, and `e` implements the required traits. Example:
    ```
    error: the borrowed expression implements the required traits
      --> $DIR/needless_borrow.rs:131:51
       |
    LL |     let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
       |                                                   ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
    ```
    
    r? `@Jarcho`
    
    changelog: Enhance `needless_borrow` to consider trait implementations
    bors committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    c419d0a View commit details
    Browse the repository at this point in the history
  2. Dont lint on match pattern-binding

    Fixes rust-lang#9347
    
    Technically it is possible to have a blank match-pattern that does
    nothing, and we fail to lint. But its easier to be safe than sorry here.
    lukaslueg committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    e87a5a1 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#9348 - lukaslueg:issue9347, r=Alexendoo

    Don't lint on match pattern-binding in ´question_mark`
    
    Fixes rust-lang#9347
    
    Technically it is possible to have a blank match-pattern that does nothing, and we fail to lint. But it's easier to be safe than sorry here.
    
    changelog: [`question_mark`]: don't lint `if let`s with subpatterns
    bors committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    eeaaba3 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2022

  1. Auto merge of rust-lang#9295 - Guilherme-Vasconcelos:manual-empty-str…

    …ing-creation, r=dswij
    
    Add `manual_empty_string_creations` lint
    
    Closes rust-lang#2972
    
    - [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`
    
    changelog: [`manual_empty_string_creations`]: Add lint for empty String not being created with `String::new()`
    bors committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    868dba9 View commit details
    Browse the repository at this point in the history
  2. Add [unused_peekable] lint

    Serial-ATA committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    2666c38 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0efafa4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8ab2f88 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    21f5954 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2502898 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ba6a459 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e3b7797 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a8d80d5 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5bc8813 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    4523954 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    2f0ed0a View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    508cf6b View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    0cc01ce View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    226f135 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    fd53761 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    06d752e View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    e834855 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    e213b6e View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    bb0584d View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    d8d4a13 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    8acc4d2 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    d8808db View commit details
    Browse the repository at this point in the history
  24. Auto merge of rust-lang#8957 - Jarcho:more_pass_merges, r=flip1995

    More lint pass merges
    
    changelog: None
    bors committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    477c16d View commit details
    Browse the repository at this point in the history
  25. Refactor FormatArgsExpn

    Alexendoo committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    4f049f5 View commit details
    Browse the repository at this point in the history
  26. Rework only_used_in_recursion

    Jarcho committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    d95b675 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    39f4bee View commit details
    Browse the repository at this point in the history
  28. Auto merge of rust-lang#9349 - Alexendoo:format-args-expn, r=flip1995

    Refactor `FormatArgsExpn`
    
    It now for each format argument `{..}` has:
    - The `Expr` it points to, and how it does so (named/named inline/numbered/implicit)
    - The parsed `FormatSpec` (format trait/fill/align/etc., the precision/width and any value they point to)
    - Many spans
    
    The caller no longer needs to pair up arguments to their value, or separately interpret the `specs` `Expr`s when it isn't `None`
    
    The gist is that it combines the result of [`rustc_parse_format::Parser`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse_format/struct.Parser.html) with the macro expansion itself
    
    This unfortunately makes the code a bit longer, however we need to use both as neither have all the information we're after. `rustc_parse_format` doesn't have the information to resolve named arguments to their values. The macro expansion doesn't contain whether the positions are implicit/numbered/named, or the spans for format arguments
    
    Wanted by rust-lang#9233 and rust-lang#8518 to be able to port the changes from rust-lang#9040
    
    Also fixes rust-lang#8643, previously the format args seem to have been paired up with the wrong values somehow
    
    changelog: [`format_in_format_args`]: Fix false positive due to misattributed arguments
    
    r? `@flip1995`
    cc `@nyurik`
    bors committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    3e594de View commit details
    Browse the repository at this point in the history
  29. Auto merge of rust-lang#8804 - Jarcho:in_recursion, r=Alexendoo

    Rework `only_used_in_recursion`
    
    fixes rust-lang#8782
    fixes rust-lang#8629
    fixes rust-lang#8560
    fixes rust-lang#8556
    
    This is a complete rewrite of the lint. This loses some capabilities of the old implementation. Namely the ability to track through tuple and slice patterns, as well as the ability to trace through assignments.
    
    The two reported bugs are fixed with this. One was caused by using the name of the method rather than resolving to the `DefId` of the called method. The second was cause by using the existence of a cycle in the dependency graph to determine whether the parameter was used in recursion even though there were other ways to create a cycle in the graph.
    
    Implementation wise this switches from using a visitor to walking up the tree from every use of each parameter until it has been determined the parameter is used for something other than recursion. This is likely to perform better as it avoids walking the entire function a second time, and it is unlikely to walk up the HIR tree very much. Some cases would perform worse though.
    
    cc `@buttercrab`
    
    changelog: Scale back `only_used_in_recursion` to fix false positives
    changelog: Move `only_used_in_recursion` back to `complexity`
    bors committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    3a54117 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    a4413f7 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    89698b9 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    6e86687 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    a9bd0bd View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    c989746 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    fb30b64 View commit details
    Browse the repository at this point in the history
  36. Auto merge of rust-lang#9258 - Serial-ATA:unused-peekable, r=Alexendoo

    Add [`unused_peekable`] lint
    
    changelog: Add [`unused_peekable`] lint
    closes: rust-lang#854
    bors committed Aug 19, 2022
    Configuration menu
    Copy the full SHA
    2091142 View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2022

  1. Fix typos

    alex-semenyuk committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    2781ad0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b070b40 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#9355 - alex-semenyuk:fixed_typos, r=giraffate

    Fix typos
    
    changelog: none
    bors committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    0dfec01 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#9269 - nahuakang:collapsible_str_replace, r=f…

    …lip1995
    
    Lint `collapsible_str_replace`
    
    fixes rust-lang#6651
    
    ```
    changelog: [`collapsible_str_replace`]: create new lint `collapsible_str_replace`
    ```
    
    If you added a new lint, here's a checklist for things that will be
    checked during review or continuous integration.
    
    - \[x] Followed [lint naming conventions][lint_naming]
    - \[x] Added passing UI tests (including committed `.stderr` file)
    - \[x] `cargo test` passes locally
    - \[ ] Executed `cargo dev update_lints`
    - \[x] Added lint documentation
    - \[x] Run `cargo dev fmt`
    bors committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    5820add View commit details
    Browse the repository at this point in the history
  5. Add test for rust-lang#8855

    smoelius committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    6f3d398 View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#8857 - smoelius:fix-8855, r=flip1995

    Add test for rust-lang#8855
    
    Fix rust-lang#8855
    
    Here is what I think is going on.
    
    First, the expression `format!("{:>6} {:>6}", a, b.to_string())` expands to:
    ```rust
    {
        let res =
            ::alloc::fmt::format(::core::fmt::Arguments::new_v1_formatted(&["",
                                " "],
                    &[::core::fmt::ArgumentV1::new_display(&a),
                                ::core::fmt::ArgumentV1::new_display(&b.to_string())],
                    &[::core::fmt::rt::v1::Argument {
                                    position: 0usize,
                                    format: ::core::fmt::rt::v1::FormatSpec {
                                        fill: ' ',
                                        align: ::core::fmt::rt::v1::Alignment::Right,
                                        flags: 0u32,
                                        precision: ::core::fmt::rt::v1::Count::Implied,
                                        width: ::core::fmt::rt::v1::Count::Is(6usize),
                                    },
                                },
                                ::core::fmt::rt::v1::Argument {
                                    position: 1usize,
                                    format: ::core::fmt::rt::v1::FormatSpec {
                                        fill: ' ',
                                        align: ::core::fmt::rt::v1::Alignment::Right,
                                        flags: 0u32,
                                        precision: ::core::fmt::rt::v1::Count::Implied,
                                        width: ::core::fmt::rt::v1::Count::Is(6usize),
                                    },
                                }], unsafe { ::core::fmt::UnsafeArg::new() }));
        res
    }
    ```
    When I dump the expressions that get past the call to `has_string_formatting` [here](https://github.com/rust-lang/rust-clippy/blob/b312ad7d0cf0f30be2bd4658b71a3520a2e76709/clippy_lints/src/format_args.rs#L83), I see more than I would expect.
    
    In particular, I see this subexpression of the above:
    ```
                    &[::core::fmt::ArgumentV1::new_display(&a),
                                ::core::fmt::ArgumentV1::new_display(&b.to_string())],
    ```
    
    This suggests to me that more expressions are getting past [this call](https://github.com/rust-lang/rust-clippy/blob/b312ad7d0cf0f30be2bd4658b71a3520a2e76709/clippy_lints/src/format_args.rs#L71) to `FormatArgsExpn::parse` than should.
    
    Those expressions are then visited, but no `::core::fmt::rt::v1::Argument`s are found and pushed [here](https://github.com/rust-lang/rust-clippy/blob/b312ad7d0cf0f30be2bd4658b71a3520a2e76709/clippy_utils/src/macros.rs#L407).
    
    As a result, the expressions appear unformatted, hence, the false positive.
    
    My proposed fix is to restrict `FormatArgsExpn::parse` so that it only matches `Call` expressions.
    
    cc: `@akanalytics`
    
    changelog: none
    bors committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    41309df View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2022

  1. Configuration menu
    Copy the full SHA
    bafa89b View commit details
    Browse the repository at this point in the history
  2. allow check for match in lint [option_if_let_else]

    and add test case for `Result`
    J-ZhengLi authored and flip1995 committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    5d403c0 View commit details
    Browse the repository at this point in the history
  3. and check for Result

    J-ZhengLi authored and flip1995 committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    ffe7125 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f7a376e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1f75845 View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#8696 - J-ZhengLi:issue8492, r=flip1995

    check for if-some-or-ok-else-none-or-err
    
    fixes: rust-lang#8492
    
    ---
    
    changelog: make [`option_if_let_else`] to check for match expression with both Option and Result; **TODO: Change lint name? Add new lint with similar functionality?**
    bors committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    87b3afc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5048af7 View commit details
    Browse the repository at this point in the history
  8. Reduce code duplication

    Only check for the kind of loop once instead of re-desugaring it.
    flip1995 committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    318ed05 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    070b035 View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#8992 - kyoto7250:fix_8753, r=flip1995

    feat(fix): Do not lint if the target code is inside a loop
    
    close rust-lang#8753
    
    we consider the following code.
    
    ```rust
    fn main() {
        let vec = vec![1];
        let w: Vec<usize> = vec.iter().map(|i| i * i).collect();  // <- once.
    
        for i in 0..2 {
            let _ = w.contains(&i);
        }
    }
    ```
    
    and the clippy will issue the following warning.
    
    ```rust
    warning: avoid using `collect()` when not needed
     --> src/main.rs:3:51
      |
    3 |     let w: Vec<usize> = vec.iter().map(|i| i * i).collect();
      |                                                   ^^^^^^^
    ...
    6 |         let _ = w.contains(&i);
      |                 -------------- the iterator could be used here instead
      |
      = note: `#[warn(clippy::needless_collect)]` on by default
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
    help: check if the original Iterator contains an element instead of collecting then checking
      |
    3 ~
    4 |
    5 |     for i in 0..2 {
    6 ~         let _ = vec.iter().map(|i| i * i).any(|x| x == i);
    ```
    
    Rewrite the code as indicated.
    
    ```rust
    fn main() {
        let vec = vec![1];
    
        for i in 0..2 {
            let _ = vec.iter().map(|i| i * i).any(|x| x == i);  // <- execute `map` every loop.
        }
    }
    ```
    
    this code is valid in the compiler, but, it is different from the code before the rewrite.
    So, we should not lint, If `collect` is outside of a loop.
    
    Thank you in advance.
    
    ---
    
    changelog: Do not lint if the target code is inside a loop in `needless_collect`
    bors committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    e19a05c View commit details
    Browse the repository at this point in the history
  11. Auto merge of rust-lang#9092 - tamaroning:fix-needless-match, r=llogiq

    Fix false positives of needless_match
    
    closes: rust-lang#9084
    made needless_match take into account arm in the form of `_ if => ...`
    
    changelog: none
    bors committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    cc637ba View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    687fcf1 View commit details
    Browse the repository at this point in the history
  13. needed_ref -> needs_ref

    smoelius committed Aug 21, 2022
    Configuration menu
    Copy the full SHA
    0bc26c8 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2022

  1. Auto merge of rust-lang#9259 - smoelius:fix-9256, r=llogiq

    Fix `to_string_in_format_args` false positive
    
    Fix rust-lang#9256
    
    changelog: none
    bors committed Aug 22, 2022
    Configuration menu
    Copy the full SHA
    5735a3b View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2022

  1. Remove the symbol from ast::LitKind::Err.

    Because it's never used meaningfully.
    nnethercote committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    06d7119 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2cb5318 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#9366 - Alexendoo:manual_string_new, r=xFrednet

    Rename `manual_empty_string_creation` and move to pedantic
    
    Renames it to `manual_string_new` and moves it to the pedantic category
    
    Pedantic because it's a fairly minor style change but could be very noisy
    
    changelog: *doesn't need its own entry, but remember to s/manual_empty_string_creation/manual_string_new/ the changelog entry for rust-lang#9295*
    
    r? `@xFrednet` to get it in before the upcoming sync as this isn't a `cargo dev rename_lint` style rename
    bors committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    b33002d View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2022

  1. Stabilize #![feature(label_break_value)]

     # Stabilization proposal
    
    The feature was implemented in rust-lang#50045 by est31 and has been in nightly since 2018-05-16 (over 4 years now).
    There are [no open issues][issue-label] other than the tracking issue. There is a strong consensus that `break` is the right keyword and we should not use `return`.
    
    There have been several concerns raised about this feature on the tracking issue (other than the one about tests, which has been fixed, and an interaction with try blocks, which has been fixed).
    1. nrc's original comment about cost-benefit analysis: rust-lang#48594 (comment)
    2. joshtriplett's comments about seeing use cases: rust-lang#48594 (comment)
    3. withoutboats's comments that Rust does not need more control flow constructs: rust-lang#48594 (comment)
    
    Many different examples of code that's simpler using this feature have been provided:
    - A lexer by rpjohnst which must repeat code without label-break-value: rust-lang#48594 (comment)
    - A snippet by SergioBenitez which avoids using a new function and adding several new return points to a function: rust-lang#48594 (comment). This particular case would also work if `try` blocks were stabilized (at the cost of making the code harder to optimize).
    - Several examples by JohnBSmith: rust-lang#48594 (comment)
    - Several examples by Centril: rust-lang#48594 (comment)
    - An example by petrochenkov where this is used in the compiler itself to avoid duplicating error checking code: rust-lang#48594 (comment)
    - Amanieu recently provided another example related to complex conditions, where try blocks would not have helped: rust-lang#48594 (comment)
    
    Additionally, petrochenkov notes that this is strictly more powerful than labelled loops due to macros which accidentally exit a loop instead of being consumed by the macro matchers: rust-lang#48594 (comment)
    
    nrc later resolved their concern, mostly because of the aforementioned macro problems.
    joshtriplett suggested that macros could be able to generate IR directly
    (rust-lang#48594 (comment)) but there are no open RFCs,
    and the design space seems rather speculative.
    
    joshtriplett later resolved his concerns, due to a symmetry between this feature and existing labelled break: rust-lang#48594 (comment)
    
    withoutboats has regrettably left the language team.
    
    joshtriplett later posted that the lang team would consider starting an FCP given a stabilization report: rust-lang#48594 (comment)
    
    [issue-label]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-label_break_value+
    
     ## Report
    
    + Feature gate:
        - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/src/test/ui/feature-gates/feature-gate-label_break_value.rs
    + Diagnostics:
        - https://github.com/rust-lang/rust/blob/6b2d3d5f3cd1e553d87b5496632132565b6779d3/compiler/rustc_parse/src/parser/diagnostics.rs#L2629
        - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L749
        - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L1001
        - https://github.com/rust-lang/rust/blob/111df9e6eda1d752233482c1309d00d20a4bbf98/compiler/rustc_passes/src/loops.rs#L254
        - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L2079
        - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L1569
    + Tests:
        - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_continue.rs
        - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_unlabeled_break.rs
        - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_illegal_uses.rs
        - https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/unused_labels.rs
        - https://github.com/rust-lang/rust/blob/master/src/test/ui/run-pass/for-loop-while/label_break_value.rs
    
     ## Interactions with other features
    
    Labels follow the hygiene of local variables.
    
    label-break-value is permitted within `try` blocks:
    ```rust
    let _: Result<(), ()> = try {
        'foo: {
            Err(())?;
            break 'foo;
        }
    };
    ```
    
    label-break-value is disallowed within closures, generators, and async blocks:
    ```rust
    'a: {
        || break 'a
        //~^ ERROR use of unreachable label `'a`
        //~| ERROR `break` inside of a closure
    }
    ```
    
    label-break-value is disallowed on [_BlockExpression_]; it can only occur as a [_LoopExpression_]:
    ```rust
    fn labeled_match() {
        match false 'b: { //~ ERROR block label not supported here
            _ => {}
        }
    }
    
    macro_rules! m {
        ($b:block) => {
            'lab: $b; //~ ERROR cannot use a `block` macro fragment here
            unsafe $b; //~ ERROR cannot use a `block` macro fragment here
            |x: u8| -> () $b; //~ ERROR cannot use a `block` macro fragment here
        }
    }
    
    fn foo() {
        m!({});
    }
    ```
    
    [_BlockExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html
    [_LoopExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html
    jyn514 committed Aug 24, 2022
    Configuration menu
    Copy the full SHA
    345c42a View commit details
    Browse the repository at this point in the history
  2. Replace contains_ty(..) with Ty::contains(..)

    This removes some code we don't need and the method syntax is
    also more readable IMO.
    Michael Wright committed Aug 24, 2022
    Configuration menu
    Copy the full SHA
    a0afbdf View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#9370 - mikerite:20220824_ty_contains, r=Jarcho

    Replace `contains_ty(..)` with `Ty::contains(..)`
    
    This removes some code we don't need and the method syntax is
    also more readable IMO.
    
    changelog: none
    bors committed Aug 24, 2022
    Configuration menu
    Copy the full SHA
    79a439a View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#99332 - jyn514:stabilize-label-break-value,…

    … r=petrochenkov
    
    Stabilize `#![feature(label_break_value)]`
    
    See the stabilization report in rust-lang#48594 (comment).
    JohnTitor committed Aug 24, 2022
    Configuration menu
    Copy the full SHA
    2cdc54d View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2022

  1. uninit_vec: Vec::spare_capacity_mut is stable

    Quick documentation fix: `Vec::spare_capacity_mut` no longer needs nightly.
    sk1p committed Aug 25, 2022
    Configuration menu
    Copy the full SHA
    61aa4ef View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2022

  1. Configuration menu
    Copy the full SHA
    fb7dffe View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#9379 - royrustdev:multi_assignments, r=llogiq

    new lint
    
    This fixes rust-lang#6576
    
    If you added a new lint, here's a checklist for things that will be
    checked during review or continuous integration.
    
    - \[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`
    
    ---
    
    changelog: add [`multi_assignments`] lint
    bors committed Aug 26, 2022
    Configuration menu
    Copy the full SHA
    21f103a View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#9374 - sk1p:patch-1, r=Jarcho

    uninit_vec: Vec::spare_capacity_mut is stable
    
    Quick documentation fix: `Vec::spare_capacity_mut` no longer needs nightly.
    
    changelog: none
    bors committed Aug 26, 2022
    Configuration menu
    Copy the full SHA
    602bec2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fe93b8d View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2022

  1. Implemented suspicious_to_owned lint to check if to_owned is called…

    … on a `Cow`.
    
    This is done because `to_owned` is very similarly named to `into_owned`, but the
    effect of calling those two methods is completely different. This creates
    confusion (stemming from the ambiguity of the 'owned' term in the context of
    `Cow`s) and might not be what the writer intended.
    xanathar committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    de028e2 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#9381 - lukaslueg:issue9361, r=dswij

    Don't lint `needless_return` if `return` has attrs
    
    Fixes rust-lang#9361
    
    The lint used to have a mechanic to allow `cfg`-attrs on naked `return`-statements. This was well-intentioned, yet we can have any kind of attribute, e.g. `allow`, `expect` or even custom `derive`. So the mechanic was simply removed. We now never lint on a naked `return`-statement that has attributes on it.
    
    Turns out that the ui-test had a Catch22 in it: In `check_expect()` the `#[expect(clippy::needless_return)]` is an attribute on the `return` statement that can and will be rustfixed away without side effects. But any other attribute would also have been removed, which is what rust-lang#9361 is about. The test proved the wrong thing. Removed the test, the body is tested elsewhere as well.
    
    changelog: Ignore [`needless_return`] on `return`s with attrs
    bors committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    be8bd60 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    90fe3be View commit details
    Browse the repository at this point in the history
  4. Add span_contains_comments util

    dswij committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    51e9113 View commit details
    Browse the repository at this point in the history
  5. Ignore when there is comment

    dswij committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    b07d72b View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#8984 - xanathar:pr/suspicious_to_owned, r=llogiq

    Implemented `suspicious_to_owned` lint to check if `to_owned` is called on a `Cow`
    
    changelog: Add lint ``[`suspicious_to_owned`]``
    
    -----------------
    Hi,
    posting this unsolicited PR as I've been burned by this issue :)
    Being unsolicited, feel free to reject it or reassign a different lint level etc.
    
    This lint checks whether `to_owned` is called on `Cow<'_, _>`. This is done because `to_owned` is very similarly named to `into_owned`, but the effect of calling those two methods is completely different (one makes the `Cow::Borrowed` into a `Cow::Owned`, the other just clones the `Cow`). If the cow is then passed to code for which the type is not checked (e.g. generics, closures, etc.) it might slip through and if the cow data is coming from an unsafe context there is the potential for accidentally cause undefined behavior.
    Even if not falling into this painful case, there's really no reason to call `to_owned` on a `Cow` other than confusing people reading the code: either `into_owned` or `clone` should be called.
    
    Note that this overlaps perfectly with `implicit_clone` as a warning, but `implicit_clone` is classified pedantic (while the consequences for `Cow` might be of a wider blast radius than just pedantry); given the overlap, I set-up the lint so that if `suspicious_to_owned` triggers `implicit_clone` will not trigger. I'm not 100% sure this is done in the correct way (I tried to copy what other lints were doing) so please provide feedback on it if it isn't.
    
    ### Checklist
    
    - \[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`
    bors committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    2d4d8e1 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2022

  1. Configuration menu
    Copy the full SHA
    9678751 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    722d136 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#9276 - dswij:9164, r=flip1995

    Ignore `match_like_matches_macro` when there is comment
    
    Closes rust-lang#9164
    
    changelog: [`match_like_matches_macro`] is ignored when there is some comment inside the match block.
    
    Also add `span_contains_comment` util to check if given span contains comments.
    bors committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    8d9da4d View commit details
    Browse the repository at this point in the history
  4. Make CI pass

    hkmatsumoto committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    75ed56f View commit details
    Browse the repository at this point in the history
  5. Support method calls

    hkmatsumoto committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    1529137 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c542f1f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3ad398d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    278b092 View commit details
    Browse the repository at this point in the history
  9. Fixes for latest nightly

    Jarcho committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    9790a32 View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#9389 - lukaslueg:penmacro, r=llogiq

    Don't lint literal `None` from expansion
    
    This addresses rust-lang/rust-clippy#9288 (comment): If the literal `None` is from expansion, we never lint. This is correct because e.g. replacing the call to `option_env!` with whatever that macro expanded to at the time of linting is certainly wrong.
    
    changelog: Don't lint [`partialeq_to_none`] for macro-expansions
    bors committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    4e31c8c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    e550739 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2022

  1. Auto merge of rust-lang#9388 - Jarcho:rustup, r=Jarcho

    Rustup
    
    Hopefully this is done right.
    
    changelog: None
    bors committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    28ec27b View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#9385 - rust-lang:unnecessary-cast-remove-pare…

    …ns, r=Alexendoo
    
    remove parenthesis from `unnecessary_cast` suggestion
    
    This fixes rust-lang#9380.
    
    ---
    
    changelog: none
    bors committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    58bbb1a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    26a6891 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c5a8230 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    30979bf View commit details
    Browse the repository at this point in the history
  6. Update clippy_lints/src/casts/mod.rs

    Co-authored-by: Alex Macleod <alex@macleod.io>
    clubby789 and Alexendoo committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    cc9f203 View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#9247 - clubby789:raw_slice_pointer_cast, r=Al…

    …exendoo
    
    New lint: Raw slice pointer cast
    
    Adds a lint to check for a raw slice being created and cast back to a pointer, suggesting `ptr::slice_from_raw_parts`, to identify UB such as thomcc/rust-typed-arena#54.
    ```
    changelog: [`cast_slice_from_raw_parts`]: Add lint to check for `slice::from_raw_parts(.., ..) as *const _`
    ```
    bors committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    e9f7ce1 View commit details
    Browse the repository at this point in the history
  8. Auto merge of rust-lang#9395 - Alexendoo:suspicious-to-owned-test, r=…

    …Manishearth
    
    Fix `suspicious_to_owned` test when `c_char` is `u8`
    
    e.g. on aarch64 linux
    
    changelog: none
    bors committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    e1ecdb6 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    9ffc5a5 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2022

  1. Auto merge of rust-lang#9394 - lukaslueg:issue9391, r=Jarcho

    Fix missing parens in `suboptimal_flops` suggestion
    
    Fixes rust-lang#9391. The problem is simple enough, I didn't check if the same problem occurs elsewhere, though.
    
    changelog: fix missing parenthesis in `suboptimal_flops` suggestion
    bors committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    4df6032 View commit details
    Browse the repository at this point in the history
  2. add UI test for unpretty

    chenyukang committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    77eb1ae View commit details
    Browse the repository at this point in the history
  3. Fix the order of trait_duplication_in_bounds

    * Emit the lint in source order
    * Make suggestions with multiple traits be in source order rather than alphabetical
    Jarcho committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    19ef04f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    66a9705 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#9373 - lukaslueg:result_large_err, r=Alexendoo

    Initial implementation `result_large_err`
    
    This is a shot at rust-lang#6560, rust-lang#4652, and rust-lang#3884. The lint checks for `Result` being returned from functions/methods where the `Err` variant is larger than a configurable threshold (the default of which is 128 bytes). There has been some discussion around this, which I'll try to quickly summarize:
    
    * A large `Err`-variant may force an equally large `Result` if `Err` is actually bigger than `Ok`.
    * There is a cost involved in large `Result`, as LLVM may choose to `memcpy` them around above a certain size.
    * We usually expect the `Err` variant to be seldomly used, but pay the cost every time.
    * `Result` returned from library code has a high chance of bubbling up the call stack, getting stuffed into `MyLibError { IoError(std::io::Error), ParseError(parselib::Error), ...}`, exacerbating the problem.
    
    This PR deliberately does not take into account comparing the `Ok` to the `Err` variant (e.g. a ratio, or one being larger than the other). Rather we choose an absolute threshold for `Err`'s size, above which we warn. The reason for this is that `Err`s probably get `map_err`'ed further up the call stack, and we can't draw conclusions from the ratio at the point where the `Result` is returned. A relative threshold would also be less predictable, while not accounting for the cost of LLVM being forced to generate less efficient code if the `Err`-variant is _large_ in absolute terms.
    
    We lint private functions as well as public functions, as the perf-cost applies to in-crate code as well.
    
    In order to account for type-parameters, I conjured up `fn approx_ty_size`. The function relies on `LateContext::layout_of` to compute the actual size, and in case of failure (e.g. due to generics) tries to come up with an "at least size". In the latter case, the size of obviously wrong, but the inspected size certainly can't be smaller than that. Please give the approach a heavy dose of review, as I'm not actually familiar with the type-system at all (read: I have no idea what I'm doing).
    
    The approach does, however flimsy it is, allow us to successfully lint situations like
    
    ```rust
    pub union UnionError<T: Copy> {
        _maybe: T,
        _or_perhaps_even: (T, [u8; 512]),
    }
    
    // We know `UnionError<T>` will be at least 512 bytes, no matter what `T` is
    pub fn param_large_union<T: Copy>() -> Result<(), UnionError<T>> {
        Ok(())
    }
    ```
    
    I've given some refactoring to `functions/result_unit_err.rs` to re-use some bits. This is also the groundwork for rust-lang#6409
    
    The default threshold is 128 because of rust-lang/rust-clippy#4652 (comment)
    
    `lintcheck` does not trigger this lint for a threshold of 128. It does warn for 64, though.
    
    The suggestion currently is the following, which is just a placeholder for discussion to be had. I did have the computed size in a `span_label`. However, that might cause both ui-tests here and lints elsewhere to become flaky wrt to their output (as the size is platform dependent).
    
    ```
    error: the `Err`-variant returned via this `Result` is very large
      --> $DIR/result_large_err.rs:36:34
       |
    LL | pub fn param_large_error<R>() -> Result<(), (u128, R, FullyDefinedLargeError)> {
       |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The `Err` variant is unusually large, at least 128 bytes
    ```
    
    changelog: Add [`result_large_err`] lint
    bors committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    09e4659 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2022

  1. Fix uintended diagnostic caused by drain(..)

    Donough Liu authored and bogon-right committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    3f66efd View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#9397 - Jarcho:trait_dup_order, r=dswij

    Fix the emission order of `trait_duplication_in_bounds`
    
    Makes the lint emit in source order rather than whatever order the hash map happens to be in. This is currently blocking the sync into rustc.
    
    changelog: None
    bors committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    f51aade View commit details
    Browse the repository at this point in the history
  3. Link “? operator” to relevant chapter in The Book

    Before, the text simply asked people to use a symbol which is hard to
    search for. Now the text links back to the chapter on error
    propagation in The Book. That should help people find the relevant
    keywords for further searches.
    mgeisler committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    e10ab62 View commit details
    Browse the repository at this point in the history
  4. Simplify MIR opt tests

    This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These
    tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due
    to having excessively strong opinions over *how* a piece of code should be optimized.
    
    Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for
    code where we want to track what the result of the net result of the optimization pipeline's output
    is.
    JakobDegen committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    4a33bf3 View commit details
    Browse the repository at this point in the history
  5. migrate rustc_query_system to use SessionDiagnostic

    with manual impl SessionDiagnostic
    evopen committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    b8075e4 View commit details
    Browse the repository at this point in the history
  6. link related issue to FIXME

    Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
    evopen and davidtwco committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    d7e07c0 View commit details
    Browse the repository at this point in the history
  7. use derive proc macro to impl SessionDiagnostic

    fixes `SessionSubdiagnostic` to accept multiple attributes
    emitting list of fluent message remains unresolved
    evopen committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    ac638c1 View commit details
    Browse the repository at this point in the history
  8. delete leftover comment

    evopen committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    166aef9 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7ce59eb View commit details
    Browse the repository at this point in the history
  10. lint: avoid linting diag functions with diag lints

    Functions annotated with `#[rustc_lint_diagnostics]` are used by the
    diagnostic migration lints to know when to lint, but functions that are
    annotated with this attribute shouldn't themselves be linted.
    
    Signed-off-by: David Wood <david.wood@huawei.com>
    davidtwco committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    11fc785 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9a67767 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    cacc7bf View commit details
    Browse the repository at this point in the history
  13. Use CountIsStart in clippy

    Jarcho committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    7ed1333 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#100787 - chenyukang:fix-100770-pretty-crash…

    …, r=petrochenkov
    
    Pretty printing give proper error message without panic
    
    Fixes rust-lang#100770
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    fa49d58 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#100827 - JakobDegen:better-tests, r=wesleyw…

    …iser
    
    Simplify MIR opt tests
    
    This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due to having excessively strong opinions over *how* a piece of code should be optimized.
    
    Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for code where we want to track what the end to end effect of the optimization pipeline on the example code is.
    
    r? ``@wesleywiser``
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    62b35a7 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#100838 - hkmatsumoto:move-gen-args-to-trait…

    …-when-appropriate, r=davidtwco
    
    Suggest moving redundant generic args of an assoc fn to its trait
    
    Closes rust-lang#89064
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    2d7644a View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#100844 - evopen:migrate-diag, r=davidtwco

    migrate rustc_query_system to use SessionDiagnostic
    
    issues:
    * variable list is not supported in fluent
    * ~~cannot have two sub diagnostic with the same tag (eg. 2 .note or 2 .help)~~
    
    allow multiple tag with SessionSubdiagnostic derive
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    c8fede9 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#101140 - Jarcho:clippyup, r=Jarcho

    Update Clippy
    
    r? ``@Manishearth``
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    3af942d View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#101161 - ldm0:ldm_fix_diagnostic, r=cjgillot

    Fix uintended diagnostic caused by `drain(..)`
    
    Calling `drain(..)` makes later `suggestable_variants.is_empty()` always true, which makes the diagnostics unintended.
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    579c050 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#101229 - mgeisler:link-try-operator, r=thomcc

    Link “? operator” to relevant chapter in The Book
    
    Before, the text simply asked people to use a symbol which is hard to
    search for. Now the text links back to the chapter on error
    propagation in The Book. That should help people find the relevant
    keywords for further searches.
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    99154f5 View commit details
    Browse the repository at this point in the history
  21. Rollup merge of rust-lang#101230 - davidtwco:translation-internal-lin…

    …t-no-self-lint, r=fee1-dead
    
    lint: avoid linting diag functions with diag lints
    
    Functions annotated with `#[rustc_lint_diagnostics]` are used by the diagnostic migration lints to know when to lint, but functions that are annotated with this attribute shouldn't themselves be linted.
    
    cc rust-lang#100717 rust-lang#101041 (comment)
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    2e0b1d8 View commit details
    Browse the repository at this point in the history
  22. Rollup merge of rust-lang#101240 - JohnTitor:JohnTitor-patch-1, r=ehuss

    Fix a typo on `wasm64-unknown-unknown` doc
    matthiaskrgr committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    d78ae31 View commit details
    Browse the repository at this point in the history