rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Add `needless_maybe_sized` lint

Open Alexendoo opened this issue 1 year ago • 10 comments

changelog: new lint: [needless_maybe_sized]

Closes #10600

Alexendoo avatar Apr 11 '23 19:04 Alexendoo

r? @giraffate

(rustbot has picked a reviewer for you, use r? to override)

rustbot avatar Apr 11 '23 19:04 rustbot

r? Jarcho

I'm not sure if the trace with spans is really worth it. It takes up a lot space and most of the info is not very useful. Is there a way to just print the location without the snippet?

One extension would be to check if any of the traits have functions using Self by value. e.g.

trait T {
  fn foo() -> Self;
}

There's no Sized bound on the trait, but it's also unimplementable for unsized types.

Jarcho avatar Feb 14 '24 06:02 Jarcho

I don't think there is a way to keep the location while hiding the snippet, but we could make them regular notes

Alexendoo avatar Feb 16 '24 18:02 Alexendoo

:umbrella: The latest upstream changes (presumably #12259) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Feb 24 '24 13:02 bors

I ditched the spans for the trace, doesn't have the location but it seems fine to me. Most of the time it should be clear which traits are the cause but if not the user can always follow the bounds themselves

Alexendoo avatar Mar 22 '24 16:03 Alexendoo

Too bad there's no option for printing spans like that.

Jarcho avatar Apr 04 '24 22:04 Jarcho

Been a week without objections. Getting the spans printed nicely isn't a blocker and can be added in later.

@bors r+

Jarcho avatar Apr 12 '24 18:04 Jarcho

:pushpin: Commit 0bc60dc4b61e969aa3ee92b700aa125b210a1516 has been approved by Jarcho

It is now in the queue for this repository.

bors avatar Apr 12 '24 18:04 bors

:hourglass: Testing commit 0bc60dc4b61e969aa3ee92b700aa125b210a1516 with merge fb65e02771f85fb7f6e19e1feedfa2900229feb1...

bors avatar Apr 12 '24 18:04 bors

:broken_heart: Test failed - checks-action_dev_test

bors avatar Apr 12 '24 18:04 bors

getting blocked by bors for this long is kind of unfortunate.

@Jarcho, could you retry running the tests so this can get through?

J-ZhengLi avatar May 31 '24 15:05 J-ZhengLi

@bors r+

Jarcho avatar Jun 05 '24 20:06 Jarcho

:pushpin: Commit cf0b55eb6232491a7c29ac0f47564b6ee7adb13e has been approved by Jarcho

It is now in the queue for this repository.

bors avatar Jun 05 '24 20:06 bors

:hourglass: Testing commit cf0b55eb6232491a7c29ac0f47564b6ee7adb13e with merge 6cfd4ac9557bf339db1ddf883a06e017e9f1fb64...

bors avatar Jun 05 '24 20:06 bors

:sunny: Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test Approved by: Jarcho Pushing 6cfd4ac9557bf339db1ddf883a06e017e9f1fb64 to master...

bors avatar Jun 05 '24 20:06 bors