Skip to content

Commit 6bdc032

Browse files
committed
Auto merge of #119606 - nnethercote:consuming-emit, r=oli-obk
Consuming `emit` This PR makes `DiagnosticBuilder::emit` consuming, i.e. take `self` instead of `&mut self`. This is good because it doesn't make sense to emit a diagnostic twice. This requires some changes to `DiagnosticBuilder` method changing -- every existing non-consuming chaining method gets a new consuming partner with a `_mv` suffix -- but permits a host of beneficial follow-up changes: more concise code through more chaining, removal of redundant diagnostic construction API methods, and removal of machinery to track the possibility of a diagnostic being emitted multiple times. r? `@compiler-errors`
2 parents 103f952 + 47f8ac9 commit 6bdc032

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_config/src/msrvs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Msrv {
109109
if let Some(duplicate) = msrv_attrs.last() {
110110
sess.dcx()
111111
.struct_span_err(duplicate.span, "`clippy::msrv` is defined multiple times")
112-
.span_note(msrv_attr.span, "first definition found here")
112+
.span_note_mv(msrv_attr.span, "first definition found here")
113113
.emit();
114114
}
115115

clippy_utils/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub fn get_unique_attr<'a>(
136136
if let Some(duplicate) = unique_attr {
137137
sess.dcx()
138138
.struct_span_err(attr.span, format!("`{name}` is defined multiple times"))
139-
.span_note(duplicate.span, "first definition found here")
139+
.span_note_mv(duplicate.span, "first definition found here")
140140
.emit();
141141
} else {
142142
unique_attr = Some(attr);

0 commit comments

Comments
 (0)