summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed')
-rw-r--r--src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed b/src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed
new file mode 100644
index 000000000..d6e47d07b
--- /dev/null
+++ b/src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed
@@ -0,0 +1,40 @@
+//@run-rustfix
+//@aux-build:proc_macros.rs:proc-macro
+#![allow(
+ clippy::needless_return,
+ clippy::no_effect,
+ clippy::unit_arg,
+ clippy::useless_conversion,
+ unused
+)]
+
+#[macro_use]
+extern crate proc_macros;
+
+fn a() -> u32 {
+ return 0;
+}
+
+fn b() -> Result<u32, u32> {
+ return Err(0);
+}
+
+// Do not lint
+fn c() -> Option<()> {
+ return None?;
+}
+
+fn main() -> Result<(), ()> {
+ Err(())?;
+ return Ok::<(), ()>(());
+ Err(())?;
+ Ok::<(), ()>(());
+ return Err(().into());
+ external! {
+ return Err(())?;
+ }
+ with_span! {
+ return Err(())?;
+ }
+ Err(())
+}