mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
20 lines
445 B
Rust
20 lines
445 B
Rust
|
#![warn(clippy::useless_conversion)]
|
||
|
|
||
|
use std::iter::FromIterator;
|
||
|
use std::option::IntoIter as OptionIter;
|
||
|
|
||
|
fn eq<T: Eq>(a: T, b: T) -> bool {
|
||
|
a == b
|
||
|
}
|
||
|
|
||
|
macro_rules! tests {
|
||
|
($($expr:expr, $ty:ty, ($($test:expr),*);)+) => (pub fn main() {$({
|
||
|
const C: $ty = $expr;
|
||
|
assert!(eq(C($($test),*), $expr($($test),*)));
|
||
|
})+})
|
||
|
}
|
||
|
|
||
|
tests! {
|
||
|
FromIterator::from_iter, fn(OptionIter<i32>) -> Vec<i32>, (Some(5).into_iter());
|
||
|
}
|