Skip to content

needless_borrow complains when a type alias with reference is used #2908

Closed
@hmvp

Description

@hmvp

Example code:

pub type SomeError: &'static str;

pub enum MyError {
    SomeErrorKind(SomeError),
}

results in

error: this pattern creates a reference to a reference
  --> file.rs:3:15
   |
3  |     SomeErrorKind(SomeError),
   |                   ^^^^^^^^^ help: change this to: `SomeError`
   |

In my case the SomeError type comes from an external library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions