Skip to content

Unnecessary references for casting from immutable reference to mutable reference. #1212

Closed
@ticki

Description

@ticki

A warning should be generated with:

let mut a = 2;
let mut a_mut = &mut a;
let a_ref: &u8 = &a_mut;

which is more approriately written as:

let mut a = 2;
let mut a_mut = &mut a;
let a_ref: &u8 = a_mut;

(when possible)

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesT-middleType: Probably requires verifiying types

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions