mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-24 12:03:28 +00:00
40 lines
568 B
Rust
40 lines
568 B
Rust
//@aux-build:proc_macros.rs
|
|
#![warn(clippy::unused_result_ok)]
|
|
#![allow(dead_code)]
|
|
|
|
#[macro_use]
|
|
extern crate proc_macros;
|
|
|
|
fn bad_style(x: &str) {
|
|
let _ = x.parse::<u32>();
|
|
}
|
|
|
|
fn good_style(x: &str) -> Option<u32> {
|
|
x.parse::<u32>().ok()
|
|
}
|
|
|
|
#[rustfmt::skip]
|
|
fn strange_parse(x: &str) {
|
|
let _ = x . parse::<i32>();
|
|
}
|
|
|
|
macro_rules! v {
|
|
() => {
|
|
Ok::<(), ()>(())
|
|
};
|
|
}
|
|
|
|
macro_rules! w {
|
|
() => {
|
|
let _ = Ok::<(), ()>(());
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
let _ = v!();
|
|
w!();
|
|
|
|
external! {
|
|
Ok::<(),()>(()).ok();
|
|
};
|
|
}
|