Skip to content

Commit 98e7a4e

Browse files
authored
Rollup merge of #83863 - eggyal:issue-83852, r=jyn514
Render destructured struct function param names as underscore Fixes #83852 r? ````@GuillaumeGomez````
2 parents 445aa40 + 14fac68 commit 98e7a4e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/librustdoc/clean/utils.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -251,19 +251,9 @@ crate fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
251251
debug!("trying to get a name from pattern: {:?}", p);
252252

253253
Symbol::intern(&match p.kind {
254-
PatKind::Wild => return kw::Underscore,
254+
PatKind::Wild | PatKind::Struct(..) => return kw::Underscore,
255255
PatKind::Binding(_, _, ident, _) => return ident.name,
256256
PatKind::TupleStruct(ref p, ..) | PatKind::Path(ref p) => qpath_to_string(p),
257-
PatKind::Struct(ref name, ref fields, etc) => format!(
258-
"{} {{ {}{} }}",
259-
qpath_to_string(name),
260-
fields
261-
.iter()
262-
.map(|fp| format!("{}: {}", fp.ident, name_from_pat(&fp.pat)))
263-
.collect::<Vec<String>>()
264-
.join(", "),
265-
if etc { ", .." } else { "" }
266-
),
267257
PatKind::Or(ref pats) => pats
268258
.iter()
269259
.map(|p| name_from_pat(&**p).to_string())
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![crate_name = "foo"]
2+
3+
struct BodyId {
4+
hir_id: usize,
5+
}
6+
7+
// @has 'foo/fn.body_owner.html' '//*[@class="rust fn"]' 'pub fn body_owner(_: BodyId)'
8+
pub fn body_owner(BodyId { hir_id }: BodyId) {
9+
// ...
10+
}

0 commit comments

Comments
 (0)