Skip to content

✅️Option<&T>; ❌️&Option<T> #13054

Closed
@Rudxain

Description

@Rudxain

What it does

Title says it all, but it could be extended to Result and other enums

Advantage

helix-editor/helix#11091

Drawbacks

If a lib has this lint, it could lead to public API breakage. However, it may be worth it, considering this lint could prevent further breakages

Example

fn f<T>(a: &Option<T>) {
    let _ = a.as_ref();
}

Could be written as:

fn f<T>(a: Option<&T>) {
    let _ = a;
}

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions