Skip to content

Commit a74fa7a

Browse files
Merge branch 'master' into 12015
2 parents 4bf9066 + 174a0d7 commit a74fa7a

File tree

66 files changed

+935
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+935
-190
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5101,6 +5101,7 @@ Released 2018-09-13
51015101
[`duplicate_mod`]: https://rust-lang.github.io/rust-clippy/master/index.html#duplicate_mod
51025102
[`duplicate_underscore_argument`]: https://rust-lang.github.io/rust-clippy/master/index.html#duplicate_underscore_argument
51035103
[`duration_subsec`]: https://rust-lang.github.io/rust-clippy/master/index.html#duration_subsec
5104+
[`eager_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#eager_transmute
51045105
[`else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else
51055106
[`empty_drop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_drop
51065107
[`empty_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum
@@ -5482,6 +5483,7 @@ Released 2018-09-13
54825483
[`ptr_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
54835484
[`ptr_offset_with_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
54845485
[`pub_enum_variant_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names
5486+
[`pub_underscore_fields`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields
54855487
[`pub_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_use
54865488
[`pub_with_shorthand`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_with_shorthand
54875489
[`pub_without_shorthand`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_without_shorthand
@@ -5810,4 +5812,5 @@ Released 2018-09-13
58105812
[`allowed-dotfiles`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-dotfiles
58115813
[`enforce-iter-loop-reborrow`]: https://doc.rust-lang.org/clippy/lint_configuration.html#enforce-iter-loop-reborrow
58125814
[`check-private-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items
5815+
[`pub-underscore-fields-behavior`]: https://doc.rust-lang.org/clippy/lint_configuration.html#pub-underscore-fields-behavior
58135816
<!-- end autogenerated links to configuration documentation -->

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.76"
3+
version = "0.1.77"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

book/src/lint_configuration.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,3 +805,13 @@ for _ in &mut *rmvec {}
805805
* [`missing_errors_doc`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc)
806806

807807

808+
## `pub-underscore-fields-behavior`
809+
810+
811+
**Default Value:** `"PublicallyExported"`
812+
813+
---
814+
**Affected lints:**
815+
* [`pub_underscore_fields`](https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields)
816+
817+

clippy_config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.76"
3+
version = "0.1.77"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

clippy_config/src/conf.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::msrvs::Msrv;
2-
use crate::types::{DisallowedPath, MacroMatcher, MatchLintBehaviour, Rename};
2+
use crate::types::{DisallowedPath, MacroMatcher, MatchLintBehaviour, PubUnderscoreFieldsBehaviour, Rename};
33
use crate::ClippyConfiguration;
44
use rustc_data_structures::fx::FxHashSet;
55
use rustc_session::Session;
@@ -547,6 +547,11 @@ define_Conf! {
547547
///
548548
/// Whether to also run the listed lints on private items.
549549
(check_private_items: bool = false),
550+
/// Lint: PUB_UNDERSCORE_FIELDS
551+
///
552+
/// Lint "public" fields in a struct that are prefixed with an underscore based on their
553+
/// exported visibility; or whether they are marked as "pub".
554+
(pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour = PubUnderscoreFieldsBehaviour::PublicallyExported),
550555
}
551556

552557
/// Search for the configuration file.
@@ -636,11 +641,12 @@ impl Conf {
636641
match path {
637642
Ok((_, warnings)) => {
638643
for warning in warnings {
639-
sess.warn(warning.clone());
644+
sess.dcx().warn(warning.clone());
640645
}
641646
},
642647
Err(error) => {
643-
sess.err(format!("error finding Clippy's configuration file: {error}"));
648+
sess.dcx()
649+
.err(format!("error finding Clippy's configuration file: {error}"));
644650
},
645651
}
646652

@@ -652,7 +658,7 @@ impl Conf {
652658
Ok((Some(path), _)) => match sess.source_map().load_file(path) {
653659
Ok(file) => deserialize(&file),
654660
Err(error) => {
655-
sess.err(format!("failed to read `{}`: {error}", path.display()));
661+
sess.dcx().err(format!("failed to read `{}`: {error}", path.display()));
656662
TryConf::default()
657663
},
658664
},
@@ -663,14 +669,14 @@ impl Conf {
663669

664670
// all conf errors are non-fatal, we just use the default conf in case of error
665671
for error in errors {
666-
sess.span_err(
672+
sess.dcx().span_err(
667673
error.span,
668674
format!("error reading Clippy's configuration file: {}", error.message),
669675
);
670676
}
671677

672678
for warning in warnings {
673-
sess.span_warn(
679+
sess.dcx().span_warn(
674680
warning.span,
675681
format!("error reading Clippy's configuration file: {}", warning.message),
676682
);

clippy_config/src/msrvs.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Msrv {
8484
(None, Some(cargo_msrv)) => self.stack = vec![cargo_msrv],
8585
(Some(clippy_msrv), Some(cargo_msrv)) => {
8686
if clippy_msrv != cargo_msrv {
87-
sess.warn(format!(
87+
sess.dcx().warn(format!(
8888
"the MSRV in `clippy.toml` and `Cargo.toml` differ; using `{clippy_msrv}` from `clippy.toml`"
8989
));
9090
}
@@ -107,7 +107,8 @@ impl Msrv {
107107

108108
if let Some(msrv_attr) = msrv_attrs.next() {
109109
if let Some(duplicate) = msrv_attrs.last() {
110-
sess.struct_span_err(duplicate.span, "`clippy::msrv` is defined multiple times")
110+
sess.dcx()
111+
.struct_span_err(duplicate.span, "`clippy::msrv` is defined multiple times")
111112
.span_note(msrv_attr.span, "first definition found here")
112113
.emit();
113114
}
@@ -117,9 +118,10 @@ impl Msrv {
117118
return Some(version);
118119
}
119120

120-
sess.span_err(msrv_attr.span, format!("`{msrv}` is not a valid Rust version"));
121+
sess.dcx()
122+
.span_err(msrv_attr.span, format!("`{msrv}` is not a valid Rust version"));
121123
} else {
122-
sess.span_err(msrv_attr.span, "bad clippy attribute");
124+
sess.dcx().span_err(msrv_attr.span, "bad clippy attribute");
123125
}
124126
}
125127

clippy_config/src/types.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,9 @@ unimplemented_serialize! {
126126
Rename,
127127
MacroMatcher,
128128
}
129+
130+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
131+
pub enum PubUnderscoreFieldsBehaviour {
132+
PublicallyExported,
133+
AllPubFields,
134+
}

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.76"
3+
version = "0.1.77"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/async_yields_async.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_hir_and_then;
22
use clippy_utils::source::snippet;
33
use clippy_utils::ty::implements_trait;
44
use rustc_errors::Applicability;
5-
use rustc_hir::{Body, BodyId, CoroutineKind, CoroutineSource, ExprKind, QPath};
5+
use rustc_hir::{Closure, ClosureKind, CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, ExprKind, QPath};
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_session::declare_lint_pass;
88

@@ -44,16 +44,22 @@ declare_clippy_lint! {
4444
declare_lint_pass!(AsyncYieldsAsync => [ASYNC_YIELDS_ASYNC]);
4545

4646
impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
47-
fn check_body(&mut self, cx: &LateContext<'tcx>, body: &'tcx Body<'_>) {
48-
use CoroutineSource::{Block, Closure};
47+
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
4948
// For functions, with explicitly defined types, don't warn.
5049
// XXXkhuey maybe we should?
51-
if let Some(CoroutineKind::Async(Block | Closure)) = body.coroutine_kind {
50+
if let ExprKind::Closure(Closure {
51+
kind:
52+
ClosureKind::Coroutine(CoroutineKind::Desugared(
53+
CoroutineDesugaring::Async,
54+
CoroutineSource::Block | CoroutineSource::Closure,
55+
)),
56+
body: body_id,
57+
..
58+
}) = expr.kind
59+
{
5260
if let Some(future_trait_def_id) = cx.tcx.lang_items().future_trait() {
53-
let body_id = BodyId {
54-
hir_id: body.value.hir_id,
55-
};
56-
let typeck_results = cx.tcx.typeck_body(body_id);
61+
let typeck_results = cx.tcx.typeck_body(*body_id);
62+
let body = cx.tcx.hir().body(*body_id);
5763
let expr_ty = typeck_results.expr_ty(body.value);
5864

5965
if implements_trait(cx, expr_ty, future_trait_def_id, &[]) {

clippy_lints/src/await_holding_invalid.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use clippy_config::types::DisallowedPath;
22
use clippy_utils::diagnostics::span_lint_and_then;
33
use clippy_utils::{match_def_path, paths};
44
use rustc_data_structures::fx::FxHashMap;
5+
use rustc_hir as hir;
56
use rustc_hir::def_id::DefId;
6-
use rustc_hir::{Body, CoroutineKind, CoroutineSource};
77
use rustc_lint::{LateContext, LateLintPass};
88
use rustc_middle::mir::CoroutineLayout;
99
use rustc_session::impl_lint_pass;
@@ -183,8 +183,8 @@ impl AwaitHolding {
183183
}
184184
}
185185

186-
impl LateLintPass<'_> for AwaitHolding {
187-
fn check_crate(&mut self, cx: &LateContext<'_>) {
186+
impl<'tcx> LateLintPass<'tcx> for AwaitHolding {
187+
fn check_crate(&mut self, cx: &LateContext<'tcx>) {
188188
for conf in &self.conf_invalid_types {
189189
let segs: Vec<_> = conf.path().split("::").collect();
190190
for id in clippy_utils::def_path_def_ids(cx, &segs) {
@@ -193,11 +193,14 @@ impl LateLintPass<'_> for AwaitHolding {
193193
}
194194
}
195195

196-
fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
197-
use CoroutineSource::{Block, Closure, Fn};
198-
if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.coroutine_kind {
199-
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
200-
if let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(def_id) {
196+
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
197+
if let hir::ExprKind::Closure(hir::Closure {
198+
kind: hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _)),
199+
def_id,
200+
..
201+
}) = expr.kind
202+
{
203+
if let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(*def_id) {
201204
self.check_interior_types(cx, coroutine_layout);
202205
}
203206
}

clippy_lints/src/declared_lints.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
576576
crate::ptr::MUT_FROM_REF_INFO,
577577
crate::ptr::PTR_ARG_INFO,
578578
crate::ptr_offset_with_cast::PTR_OFFSET_WITH_CAST_INFO,
579+
crate::pub_underscore_fields::PUB_UNDERSCORE_FIELDS_INFO,
579580
crate::pub_use::PUB_USE_INFO,
580581
crate::question_mark::QUESTION_MARK_INFO,
581582
crate::question_mark_used::QUESTION_MARK_USED_INFO,
@@ -654,6 +655,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
654655
crate::trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS_INFO,
655656
crate::trait_bounds::TYPE_REPETITION_IN_BOUNDS_INFO,
656657
crate::transmute::CROSSPOINTER_TRANSMUTE_INFO,
658+
crate::transmute::EAGER_TRANSMUTE_INFO,
657659
crate::transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS_INFO,
658660
crate::transmute::TRANSMUTE_BYTES_TO_STR_INFO,
659661
crate::transmute::TRANSMUTE_FLOAT_TO_INT_INFO,

clippy_lints/src/doc/needless_doctest_main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::diagnostics::span_lint;
66
use rustc_ast::{CoroutineKind, Fn, FnRetTy, Item, ItemKind};
77
use rustc_data_structures::sync::Lrc;
88
use rustc_errors::emitter::EmitterWriter;
9-
use rustc_errors::Handler;
9+
use rustc_errors::DiagCtxt;
1010
use rustc_lint::LateContext;
1111
use rustc_parse::maybe_new_parser_from_source_str;
1212
use rustc_parse::parser::ForceCollect;
@@ -45,10 +45,10 @@ pub fn check(
4545
let fallback_bundle =
4646
rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
4747
let emitter = EmitterWriter::new(Box::new(io::sink()), fallback_bundle);
48-
let handler = Handler::with_emitter(Box::new(emitter)).disable_warnings();
49-
#[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_span_handler
48+
let dcx = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings();
49+
#[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_dcx
5050
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
51-
let sess = ParseSess::with_span_handler(handler, sm);
51+
let sess = ParseSess::with_dcx(dcx, sm);
5252

5353
let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) {
5454
Ok(p) => p,

clippy_lints/src/item_name_repetitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ impl LateLintPass<'_> for ItemNameRepetitions {
436436
{
437437
match item.kind {
438438
ItemKind::Enum(def, _) => check_variant(cx, self.enum_threshold, &def, item_name, item.span),
439-
ItemKind::Struct(VariantData::Struct(fields, _), _) => {
439+
ItemKind::Struct(VariantData::Struct { fields, .. }, _) => {
440440
check_fields(cx, self.struct_threshold, item, fields);
441441
},
442442
_ => (),

clippy_lints/src/len_zero.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use rustc_hir::def::Res;
88
use rustc_hir::def_id::{DefId, DefIdSet};
99
use rustc_hir::{
1010
AssocItemKind, BinOpKind, Expr, ExprKind, FnRetTy, GenericArg, GenericBound, ImplItem, ImplItemKind,
11-
ImplicitSelfKind, Item, ItemKind, LangItem, Mutability, Node, PatKind, PathSegment, PrimTy, QPath, TraitItemRef,
12-
TyKind, TypeBindingKind,
11+
ImplicitSelfKind, Item, ItemKind, Mutability, Node, OpaqueTyOrigin, PatKind, PathSegment, PrimTy, QPath,
12+
TraitItemRef, TyKind, TypeBindingKind,
1313
};
1414
use rustc_lint::{LateContext, LateLintPass};
1515
use rustc_middle::ty::{self, AssocKind, FnSig, Ty};
@@ -289,8 +289,10 @@ fn extract_future_output<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<&
289289
kind: ItemKind::OpaqueTy(opaque),
290290
..
291291
} = item
292-
&& opaque.bounds.len() == 1
293-
&& let GenericBound::LangItemTrait(LangItem::Future, _, _, generic_args) = &opaque.bounds[0]
292+
&& let OpaqueTyOrigin::AsyncFn(_) = opaque.origin
293+
&& let [GenericBound::Trait(trait_ref, _)] = &opaque.bounds
294+
&& let Some(segment) = trait_ref.trait_ref.path.segments.last()
295+
&& let Some(generic_args) = segment.args
294296
&& generic_args.bindings.len() == 1
295297
&& let TypeBindingKind::Equality {
296298
term:

clippy_lints/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
// FIXME: switch to something more ergonomic here, once available.
2323
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
2424
extern crate pulldown_cmark;
25+
extern crate rustc_abi;
2526
extern crate rustc_arena;
2627
extern crate rustc_ast;
2728
extern crate rustc_ast_pretty;
@@ -271,6 +272,7 @@ mod permissions_set_readonly_false;
271272
mod precedence;
272273
mod ptr;
273274
mod ptr_offset_with_cast;
275+
mod pub_underscore_fields;
274276
mod pub_use;
275277
mod question_mark;
276278
mod question_mark_used;
@@ -571,6 +573,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
571573
verbose_bit_mask_threshold,
572574
warn_on_all_wildcard_imports,
573575
check_private_items,
576+
pub_underscore_fields_behavior,
574577

575578
blacklisted_names: _,
576579
cyclomatic_complexity_threshold: _,
@@ -1081,6 +1084,11 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
10811084
store.register_late_pass(|_| Box::new(uninhabited_references::UninhabitedReferences));
10821085
store.register_late_pass(|_| Box::new(ineffective_open_options::IneffectiveOpenOptions));
10831086
store.register_late_pass(|_| Box::new(unconditional_recursion::UnconditionalRecursion));
1087+
store.register_late_pass(move |_| {
1088+
Box::new(pub_underscore_fields::PubUnderscoreFields {
1089+
behavior: pub_underscore_fields_behavior,
1090+
})
1091+
});
10841092
store.register_late_pass(move |_| {
10851093
Box::new(thread_local_initializer_can_be_made_const::ThreadLocalInitializerCanBeMadeConst::new(msrv()))
10861094
});

clippy_lints/src/manual_async_fn.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use clippy_utils::source::{position_before_rarrow, snippet_block, snippet_opt};
33
use rustc_errors::Applicability;
44
use rustc_hir::intravisit::FnKind;
55
use rustc_hir::{
6-
Block, Body, Closure, CoroutineKind, CoroutineSource, Expr, ExprKind, FnDecl, FnRetTy, GenericArg, GenericBound,
7-
ImplItem, Item, ItemKind, LifetimeName, Node, Term, TraitRef, Ty, TyKind, TypeBindingKind,
6+
Block, Body, Closure, ClosureKind, CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, ExprKind, FnDecl,
7+
FnRetTy, GenericArg, GenericBound, ImplItem, Item, ItemKind, LifetimeName, Node, Term, TraitRef, Ty, TyKind,
8+
TypeBindingKind,
89
};
910
use rustc_lint::{LateContext, LateLintPass};
1011
use rustc_session::declare_lint_pass;
@@ -172,15 +173,14 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
172173
}
173174

174175
fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) -> Option<&'tcx Body<'tcx>> {
175-
if let Some(block_expr) = block.expr
176-
&& let Expr {
177-
kind: ExprKind::Closure(&Closure { body, .. }),
178-
..
179-
} = block_expr
180-
&& let closure_body = cx.tcx.hir().body(body)
181-
&& closure_body.coroutine_kind == Some(CoroutineKind::Async(CoroutineSource::Block))
176+
if let Some(Expr {
177+
kind: ExprKind::Closure(&Closure { kind, body, .. }),
178+
..
179+
}) = block.expr
180+
&& let ClosureKind::Coroutine(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Block)) =
181+
kind
182182
{
183-
return Some(closure_body);
183+
return Some(cx.tcx.hir().body(body));
184184
}
185185

186186
None

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl EarlyLintPass for ManualNonExhaustiveStruct {
103103

104104
if let ast::ItemKind::Struct(variant_data, _) = &item.kind {
105105
let (fields, delimiter) = match variant_data {
106-
ast::VariantData::Struct(fields, _) => (&**fields, '{'),
106+
ast::VariantData::Struct { fields, .. } => (&**fields, '{'),
107107
ast::VariantData::Tuple(fields, _) => (&**fields, '('),
108108
ast::VariantData::Unit(_) => return,
109109
};

0 commit comments

Comments
 (0)