]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/needless_pass_by_value.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / needless_pass_by_value.rs
index 0d093adf8cd3103c0cb1a7b8db26755340744443..d79ad86b1948caa3eff6b7516b2b9f4ec6d2a453 100644 (file)
@@ -1,15 +1,17 @@
 #![warn(clippy::needless_pass_by_value)]
+#![allow(dead_code)]
 #![allow(
-    dead_code,
-    clippy::single_match,
+    clippy::option_option,
+    clippy::redundant_clone,
     clippy::redundant_pattern_matching,
-    clippy::many_single_char_names,
-    clippy::option_option
+    clippy::single_match,
+    clippy::uninlined_format_args
 )]
 
 use std::borrow::Borrow;
 use std::collections::HashSet;
 use std::convert::AsRef;
+use std::mem::MaybeUninit;
 
 // `v` should be warned
 // `w`, `x` and `y` are allowed (moved or mutated)
@@ -95,7 +97,7 @@ fn foo(
         s.len() + t.capacity()
     }
 
-    fn bar(_t: T // Ok, since `&T: Serialize` too
+    fn bar(_t: T, // Ok, since `&T: Serialize` too
     ) {
     }
 
@@ -110,11 +112,11 @@ fn visit_string(s: String) {
 }
 
 // shouldn't warn on extern funcs
-extern "C" fn ext(x: String) -> usize {
-    x.len()
+extern "C" fn ext(x: MaybeUninit<usize>) -> usize {
+    unsafe { x.assume_init() }
 }
 
-// whitelist RangeArgument
+// exempt RangeArgument
 fn range<T: ::std::ops::RangeBounds<usize>>(range: T) {
     let _ = range.start_bound();
 }