about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMahdi Dibaiee <mdibaiee@pm.me>2022-01-11 21:28:04 +0000
committerMahdi Dibaiee <mdibaiee@pm.me>2022-01-11 21:28:04 +0000
commit2728af7bc02ab48bf4dd861cb69b5b786ecb261d (patch)
treec6c482b3c60b146a018e530ebac30d649e17041a /compiler
parent959bf2bc2e79defd0fe7d3c9987a6023eb8503cd (diff)
downloadrust-2728af7bc02ab48bf4dd861cb69b5b786ecb261d.tar.gz
rust-2728af7bc02ab48bf4dd861cb69b5b786ecb261d.zip
rustc_pass_by_value: handle inferred generic types (with _)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/pass_by_value.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_lint/src/pass_by_value.rs b/compiler/rustc_lint/src/pass_by_value.rs
index 3435a5a6c82..26d0560bf89 100644
--- a/compiler/rustc_lint/src/pass_by_value.rs
+++ b/compiler/rustc_lint/src/pass_by_value.rs
@@ -73,19 +73,15 @@ fn gen_args(cx: &LateContext<'_>, segment: &PathSegment<'_>) -> String {
         let params = args
             .args
             .iter()
-            .filter_map(|arg| match arg {
-                GenericArg::Lifetime(lt) => Some(lt.name.ident().to_string()),
+            .map(|arg| match arg {
+                GenericArg::Lifetime(lt) => lt.name.ident().to_string(),
                 GenericArg::Type(ty) => {
-                    let snippet =
-                        cx.tcx.sess.source_map().span_to_snippet(ty.span).unwrap_or_default();
-                    Some(snippet)
+                    cx.tcx.sess.source_map().span_to_snippet(ty.span).unwrap_or_default()
                 }
                 GenericArg::Const(c) => {
-                    let snippet =
-                        cx.tcx.sess.source_map().span_to_snippet(c.span).unwrap_or_default();
-                    Some(snippet)
+                    cx.tcx.sess.source_map().span_to_snippet(c.span).unwrap_or_default()
                 }
-                _ => None,
+                GenericArg::Infer(_) => String::from("_"),
             })
             .collect::<Vec<_>>();