Skip to content

Commit beeaee9

Browse files
committed
Rename consuming chaining methods on DiagnosticBuilder.
In rust-lang#119606 I added them and used a `_mv` suffix, but that wasn't great. A `with_` prefix has three different existing uses. - Constructors, e.g. `Vec::with_capacity`. - Wrappers that provide an environment to execute some code, e.g. `with_session_globals`. - Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`. The third case is exactly what we want, so this commit changes `DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`. Thanks to @compiler-errors for the suggestion.
1 parent 89f511e commit beeaee9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_config/src/msrvs.rs

+1-1
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_mv(msrv_attr.span, "first definition found here")
112+
.with_span_note(msrv_attr.span, "first definition found here")
113113
.emit();
114114
}
115115

clippy_utils/src/attrs.rs

+1-1
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_mv(duplicate.span, "first definition found here")
139+
.with_span_note(duplicate.span, "first definition found here")
140140
.emit();
141141
} else {
142142
unique_attr = Some(attr);

0 commit comments

Comments
 (0)