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

fn() -> fn(u8) -> u8 is formatted as fn() -> fn(u8) -> fn(u8) -> u8 #3615

Closed
projedi opened this issue Jun 10, 2019 · 1 comment
Closed

fn() -> fn(u8) -> u8 is formatted as fn() -> fn(u8) -> fn(u8) -> u8 #3615

projedi opened this issue Jun 10, 2019 · 1 comment
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@projedi
Copy link

projedi commented Jun 10, 2019

I have a function

fn make_lazy(f: fn() -> fn(u8) -> u8) -> impl Fn(u8) -> u8 {
    Box::new(move |x| f()(x))
}

Running rustfmt --check (rustfmt 1.2.2-nightly (5274b49c 2019-04-24)) yeilds

fn make_lazy(f: fn() -> fn(u8) -> fn(u8) -> u8) -> impl Fn(u8) -> u8 {
     Box::new(move |x| f()(x))
 }

fn(u8) -> is duplicated.

  • fn() -> (fn(u8) -> u8) yields fn() -> (fn(u8) -> u8) -> (fn(u8) -> u8)
  • fn() -> impl Fn(u8) -> u8 yields fn() -> impl Fn(u8) -> impl Fn(u8) -> u8
  • impl Fn() -> fn(u8) -> u8 is fine
  • fn() -> u8 is also fine
projedi added a commit to projedi/rust-clippy that referenced this issue Jun 10, 2019
@scampi scampi added the bug Panic, non-idempotency, invalid code, etc. label Jun 10, 2019
g-bartoszek pushed a commit to g-bartoszek/rust-clippy that referenced this issue Jun 10, 2019
@topecongiro
Copy link
Contributor

This will be fixed in 1.3.0.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 13, 2019
Changes:
````
Fix wrong lifetime of TyCtxt
travis: Wait at most 30 minutes for base test
Typos and minor grammar corrections
Adds lint for integer division
redundant_closure_for_method_calls fixes: lint does not trigger when there is a difference in mutability lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
Fix implicit_return docs
rustup https://github.com/rust-lang/rust/pull/61758/files
Remove wrong lifetime from LintContext
Workaround for rust-lang/rustfmt#3615
Fixing eta with respect to lazy evaluation.
````
Centril added a commit to Centril/rust that referenced this issue Jun 13, 2019
submodules: update clippy from c0dbd34 to bd33a97

Changes:
````
Fix implicit_return docs
rustup https://github.com/rust-lang/rust/pull/61758/files
Remove wrong lifetime from LintContext
Workaround for rust-lang/rustfmt#3615
Fixing eta with respect to lazy evaluation.
````
r? @oli-obk
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue May 5, 2020
Changes:
````
Fix wrong lifetime of TyCtxt
travis: Wait at most 30 minutes for base test
Typos and minor grammar corrections
Adds lint for integer division
redundant_closure_for_method_calls fixes: lint does not trigger when there is a difference in mutability lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
Fix implicit_return docs
rustup https://github.com/rust-lang/rust/pull/61758/files
Remove wrong lifetime from LintContext
Workaround for rust-lang/rustfmt#3615
Fixing eta with respect to lazy evaluation.
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

3 participants