Skip to content

Add lint checking for no-op uses of Option::{as_deref,as_deref_mut} #7571

@LeSeulArtichaut

Description

@LeSeulArtichaut

What it does

Checks for no-op uses of Option::{as_deref,as_deref_mut}.

Categories (optional)

  • Kind: complexity

What is the advantage of the recommended code over the original code

Removes useless code, removing clutter and improving readability.

Drawbacks

None.

Example

let a = Some(&1);
let b = a.as_deref(); // goes from Option<&i32> to Option<&i32>

Could be written as:

let a = Some(&1);
let b = a;

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions