blob: 5bb2116bd339af9ef01ddc281abb2d70416a5610 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#![warn(clippy::wrong_self_convention)]
#![allow(dead_code)]
fn main() {}
mod issue6758 {
pub enum Test<T> {
One(T),
Many(Vec<T>),
}
impl<T> Test<T> {
// If a method starts with `to_` and not ends with `_mut` it should expect `&self`
pub fn to_many(&mut self) -> Option<&mut [T]> {
match self {
Self::Many(data) => Some(data),
_ => None,
}
}
// If a method starts with `to_` and ends with `_mut` it should expect `&mut self`
pub fn to_many_mut(&self) -> Option<&[T]> {
match self {
Self::Many(data) => Some(data),
_ => None,
}
}
}
}
|