Skip to content

New lint: ref_pattern, for disallowing the ref keyword #9010

@jplatte

Description

@jplatte

What it does

I would like to have a lint that fires on any use of the ref keyword.

Lint Name

ref_pattern

Category

restriction

Advantage

Code that doesn't use it is easier to read for newcomers since they're unlikely to be aware of what it does.

Drawbacks

No response

Example

if let Some(ref foo) = *rwlock.read().unwrap() {}

Could be written as:

if let Some(foo) = &*rwlock.read().unwrap() {}

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