blob: c61eb9216643e14159ca5d6fb26b93764b05e264 (
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
30
31
32
33
34
35
|
// run-rustfix
#![allow(unused)]
#![warn(clippy::match_as_ref)]
fn match_as_ref() {
let owned: Option<()> = None;
let borrowed: Option<&()> = owned.as_ref();
let mut mut_owned: Option<()> = None;
let borrow_mut: Option<&mut ()> = mut_owned.as_mut();
}
mod issue4437 {
use std::{error::Error, fmt, num::ParseIntError};
#[derive(Debug)]
struct E {
source: Option<ParseIntError>,
}
impl Error for E {
fn source(&self) -> Option<&(dyn Error + 'static)> {
self.source.as_ref().map(|x| x as _)
}
}
impl fmt::Display for E {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
unimplemented!()
}
}
}
fn main() {}
|