-// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
#![warn(clippy::single_match)]
fn dummy() {}
let z = (1u8, 1u8);
match z {
- (2...3, 7...9) => dummy(),
+ (2..=3, 7..=9) => dummy(),
_ => {},
};
// Not linted (no block with statements in the single arm)
match z {
- (2...3, 7...9) => println!("{:?}", z),
+ (2..=3, 7..=9) => println!("{:?}", z),
_ => println!("nope"),
}
}
}
}
-fn main() {}
+macro_rules! single_match {
+ ($num:literal) => {
+ match $num {
+ 15 => println!("15"),
+ _ => (),
+ }
+ };
+}
+
+fn main() {
+ single_match!(5);
+}