]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/or_fun_call.rs
Auto merge of #5562 - flip1995:clippyup_up, r=phansch
[rust.git] / tests / ui / or_fun_call.rs
index 35fd0a30f6ce121e5fc49f6829d43ef5d956287a..522f31b72d01f4d94a590dd179a86c287d1c6db4 100644 (file)
@@ -55,8 +55,6 @@ fn make<T>() -> T {
     let with_vec = Some(vec![1]);
     with_vec.unwrap_or(vec![]);
 
-    // FIXME #944: ~|SUGGESTION with_vec.unwrap_or_else(|| vec![]);
-
     let without_default = Some(Foo);
     without_default.unwrap_or(Foo::new());
 
@@ -97,6 +95,15 @@ fn test_or_with_ctors() {
     let b = "b".to_string();
     let _ = Some(Bar("a".to_string(), Duration::from_secs(1)))
         .or(Some(Bar(b, Duration::from_secs(2))));
+
+    let vec = vec!["foo"];
+    let _ = opt.ok_or(vec.len());
+
+    let array = ["foo"];
+    let _ = opt.ok_or(array.len());
+
+    let slice = &["foo"][..];
+    let _ = opt.ok_or(slice.len());
 }
 
 // Issue 4514 - early return