From 72e4e4ac6cb18e4e15c789cc0e9786b1d1d54d36 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Thu, 15 Aug 2019 22:56:27 +0200 Subject: [PATCH] Add ui test --- tests/ui/suspicious_map.rs | 5 +++++ tests/ui/suspicious_map.stderr | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/ui/suspicious_map.rs create mode 100644 tests/ui/suspicious_map.stderr diff --git a/tests/ui/suspicious_map.rs b/tests/ui/suspicious_map.rs new file mode 100644 index 00000000000..d838d8fde21 --- /dev/null +++ b/tests/ui/suspicious_map.rs @@ -0,0 +1,5 @@ +#![warn(clippy::suspicious_map)] + +fn main() { + let _ = (0..3).map(|x| x + 2).count(); +} diff --git a/tests/ui/suspicious_map.stderr b/tests/ui/suspicious_map.stderr new file mode 100644 index 00000000000..434ea089fed --- /dev/null +++ b/tests/ui/suspicious_map.stderr @@ -0,0 +1,10 @@ +error: Make sure you did not confuse `map` with `filter`. + --> $DIR/suspicious_map.rs:4:13 + | +LL | let _ = (0..3).map(|x| x + 2).count(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::suspicious-map` implied by `-D warnings` + +error: aborting due to previous error +