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 12 pull requests #5432

Closed
wants to merge 55 commits into from
Closed

Commits on Mar 20, 2020

  1. Configuration menu
    Copy the full SHA
    5f1bb72 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b53bcc7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e91f5b2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0f9a0f8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b630644 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0766002 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    74f5090 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    bce1293 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4165236 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    517fa65 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    1a7bddb View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2020

  1. Configuration menu
    Copy the full SHA
    adcaa1b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    94154ca View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e26ae7a View commit details
    Browse the repository at this point in the history
  4. Clean up update_lints

    flip1995 committed Apr 3, 2020
    Configuration menu
    Copy the full SHA
    ffb2e41 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    da67982 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    98c30fe View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a186d9f View commit details
    Browse the repository at this point in the history
  8. Make lint modules private

    flip1995 committed Apr 3, 2020
    Configuration menu
    Copy the full SHA
    d89bb50 View commit details
    Browse the repository at this point in the history
  9. Run update_lints

    flip1995 committed Apr 3, 2020
    Configuration menu
    Copy the full SHA
    045722a View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    30503a9 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2020

  1. result_map_or_into_option: add lint to catch manually adpating Result…

    … -> Option
    
    Result<T, E> has an `ok()` method that adapts a Result<T,E> into an Option<T>.
    It's possible to get around this adapter by writing Result<T,E>.map_or(None, Some).
    
    This lint is implemented as a new variant of the existing
    [`option_map_none` lint](rust-lang#2128)
    nickrtorres committed Apr 4, 2020
    Configuration menu
    Copy the full SHA
    91d8a80 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2481d3c View commit details
    Browse the repository at this point in the history
  3. Update CONTRIBUTING.md

    flip1995 committed Apr 4, 2020
    Configuration menu
    Copy the full SHA
    fac5a41 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    be34bc4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    560c8c9 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    91759a7 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3a29aed View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d0738bd View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    fb276dc View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    acc3bc1 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    2533f56 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    fecdb72 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    325d0b6 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2020

  1. Configuration menu
    Copy the full SHA
    5d54fbb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9c9af1d View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2020

  1. Configuration menu
    Copy the full SHA
    f8fd4ac View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7294acb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    16b4003 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4348af2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4f14826 View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2020

  1. Refine lint message.

    xiongmao86 committed Apr 7, 2020
    Configuration menu
    Copy the full SHA
    d7056f8 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#5345 - Toxyxer:add-lint-for-float-in-array-…

    …comparison, r=flip1995
    
    Add lint for float in array comparison
    
    Fixes rust-lang#4277
    changelog:
    - Added new handler for expression of index kind (e.g. `arr[i]`). It returns a constant when both array and index are constant, or when the array is constant and all values are equal.
    - Trigger float_cmp and float_cmp_const lint when comparing arrays. Allow for comparison when one of the arrays contains only zeros or infinities.
    - Added appropriate tests for such cases.
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    acd4342 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#5406 - flip1995:update_lints_fix, r=flip1995

    Fix update_lints
    
    This fixes a bug in update_lints, where `internal` lints were not registered properly. This also cleans up some code. For example: The code generation functions no longer filter the lints the are given. This is now the task of the caller. This way, it is more obvious in the `replace_in_file` calls which lints will be included in which part of a file.
    
    This also turns the lint modules private. There is no need for them to be public, since shared code should be in the utils module anyway.
    
    And last but not least, this fixes the `register_lints` code generation, so also internal lints get registered.
    
    changelog: none
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    3da43d0 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#5409 - dtolnay:letunit, r=flip1995

    Downgrade let_unit_value to pedantic
    
    Given that the false positive in rust-lang#1502 is marked E-hard and I don't have much hope of it getting fixed, I think it would be wise to disable this lint by default. I have had to suppress this lint in every substantial codebase (\>100k line) I have worked in. Any time this lint is being triggered, it's always the false positive case.
    
    The motivation for this lint is documented as:
    
    > A unit value cannot usefully be used anywhere. So binding one is kind of pointless.
    
    with this example:
    
    > ```rust
    > let x = {
    >     1;
    > };
    > ```
    
    Sure, but the author would find this out via an unused_variable warning or from `x` not being the type that they need further down. If there ends up being a type error on `x`, clippy's advice isn't going to help get the code compiling because it can only run if the code already compiles.
    
    changelog: Remove let_unit_value from default set of enabled lints
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    52ca269 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#5410 - dtolnay:trivially, r=flip1995

    Downgrade trivially_copy_pass_by_ref to pedantic
    
    The rationale for this lint is documented as:
    
    > In many calling conventions instances of structs will be passed through registers if they fit into two or less general purpose registers.
    
    I think the purported performance benefits of clippy's recommendation are overstated. This isn't worth asking people to sprinkle code with more `*`​`*`​`&`​`*`​`&` to chase the alleged performance.
    
    This should be a pedantic lint that is disabled by default and opted in if some specific performance sensitive codebase determines that it is worthwhile.
    
    As a reminder, a typical place that a reference to a primitive would come up is if the function is used as a filter. Triggering a performance-oriented lint on this type of code is the definition of pedantic.
    
    ```rust
    fn filter(_n: &i32) -> bool {
        true
    }
    
    fn main() {
        let v = vec![1, 2, 3];
        v.iter().copied().filter(filter).for_each(drop);
    }
    ```
    
    ```console
    warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
     --> src/main.rs:1:15
      |
    1 | fn filter(_n: &i32) -> bool {
      |               ^^^^ help: consider passing by value instead: `i32`
    ```
    
    changelog: Remove trivially_copy_pass_by_ref from default set of enabled lints
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    e26c922 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#5412 - dtolnay:tostring, r=flip1995

    Downgrade inefficient_to_string to pedantic
    
    From the [documentation](https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string):
    
    > ```diff
    > - ["foo", "bar"].iter().map(|s| s.to_string());
    >
    > + ["foo", "bar"].iter().map(|&s| s.to_string());
    > ```
    
    I feel like saving 10 nanoseconds from the formatting machinery isn't worth asking the programmer to insert extra `&` / `*` noise in the *vast* majority of cases. This is a pedantic lint.
    
    changelog: Remove inefficient_to_string from default set of enabled lints
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    5afb882 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#5415 - nickrtorres:master, r=flip1995

    Add new lint for `Result<T, E>.map_or(None, Some(T))`
    
    Fixes rust-lang#5414
    
    PR Checklist
    ---
    - [x] Followed lint naming conventions (the name is a bit awkward, but it seems to conform)
    - [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
    
    `Result<T, E>` has an [`ok()`](https://doc.rust-lang.org/std/result/enum.Result.html#method.ok) method that adapts a `Result<T,E>` into an `Option<T>`.
    It's possible to get around this adapter by writing `Result<T,E>.map_or(None, Some)`.
    
    This lint is implemented as a new variant of the existing [`option_map_none` lint](rust-lang#2128)
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    0c63766 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#5417 - flip1995:doc_update, r=flip1995

    Update doc links and mentioned names in docs
    
    changelog: none
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    858bfd4 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#5419 - dtolnay:unreadable, r=flip1995

    Downgrade unreadable_literal to pedantic
    
    As motivated by rust-lang#5418. This is the top most commonly suppressed Clippy style lint, which indicates that the community has decided they don't share Clippy's opinion on the best style of this.
    
    I've left the lint in as pedantic, though it could be that "restriction" would be better -- I can see this lint being useful as an opt-in restriction in some codebases.
    
    changelog: Remove unreadable_literal from default set of enabled lints
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    642d743 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#5420 - dtolnay:newret, r=flip1995

    Downgrade new_ret_no_self to pedantic
    
    As motivated by rust-lang#5418. This is the second most widely suppressed Clippy style lint, and [this grep.app search](https://grep.app/search?q=%5C%5Ballow%5C%28.%2Aclippy%3A%3Anew_ret_no_self%5Cb&regexp=true&case=true&filter[lang][0]=Rust) shows a large number of diverse reasonable signatures for a `new` method.
    
    changelog: Remove new_ret_no_self from default set of enabled lints
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    3ef6b9b View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#5422 - nickrtorres:contributing-triage, r=f…

    …lip1995
    
    CONTRIBUTING.md: fix broken triage link
    
    Fixes rust-lang#5421
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    e55ec76 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#5424 - jpospychala:suspicious_op_assign_imp…

    …l, r=flip1995
    
    Incorrect suspicious_op_assign_impl
    
    fixes rust-lang#5255
    
    changelog: In suspicious_op_assign_impl ignore all operators in expression if it's part of AssignOp
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    1242808 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#5425 - xiongmao86:issue5367, r=flip1995

    Ehance opt_as_ref_deref lint.
    
    - [x] Added passing UI tests (including committed `.stderr` file)
    - [x] `cargo test` passes locally
    - [x] Run `cargo dev fmt`
    
    Lint on opt.as_ref().map(|x| &**x). Fixes rust-lang#5367.
    
    changelog: lint on opt.as_ref().map(|x| &**x)
    flip1995 authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    635518f View commit details
    Browse the repository at this point in the history
  14. Run fmt

    flip1995 committed Apr 7, 2020
    Configuration menu
    Copy the full SHA
    f663da1 View commit details
    Browse the repository at this point in the history