about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-01-09 09:08:49 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-01-10 07:40:00 +1100
commited76b0b882d0acff9295bcd76c2b119cf83e7219 (patch)
treeb40f6c489904d201833e5e446afbfbee1501e26a /src
parent2ea7a37e1113febac8603729e33fdd94f2738807 (diff)
downloadrust-ed76b0b882d0acff9295bcd76c2b119cf83e7219.tar.gz
rust-ed76b0b882d0acff9295bcd76c2b119cf83e7219.zip
Rename consuming chaining methods on `DiagnosticBuilder`.
In #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.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/mod.rs2
-rw-r--r--src/librustdoc/config.rs10
-rw-r--r--src/librustdoc/core.rs6
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs2
-rw-r--r--src/tools/clippy/clippy_config/src/msrvs.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/attrs.rs2
6 files changed, 12 insertions, 12 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7e897218016..22ba9455e07 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -3001,7 +3001,7 @@ fn clean_use_statement_inner<'tcx>(
             E0780,
             "anonymous imports cannot be inlined"
         )
-        .span_label_mv(import.span, "anonymous import")
+        .with_span_label(import.span, "anonymous import")
         .emit();
     }
 
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 5a6001840e0..3f7f9270b2d 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -577,13 +577,13 @@ impl Options {
             {
                 if !theme_file.is_file() {
                     dcx.struct_err(format!("invalid argument: \"{theme_s}\""))
-                        .help_mv("arguments to --theme must be files")
+                        .with_help("arguments to --theme must be files")
                         .emit();
                     return Err(1);
                 }
                 if theme_file.extension() != Some(OsStr::new("css")) {
                     dcx.struct_err(format!("invalid argument: \"{theme_s}\""))
-                        .help_mv("arguments to --theme must have a .css extension")
+                        .with_help("arguments to --theme must have a .css extension")
                         .emit();
                     return Err(1);
                 }
@@ -595,8 +595,8 @@ impl Options {
                     dcx.struct_warn(format!(
                         "theme file \"{theme_s}\" is missing CSS rules from the default theme",
                     ))
-                    .warn_mv("the theme may appear incorrect when loaded")
-                    .help_mv(format!(
+                    .with_warn("the theme may appear incorrect when loaded")
+                    .with_help(format!(
                         "to see what rules are missing, call `rustdoc --check-theme \"{theme_s}\"`",
                     ))
                     .emit();
@@ -809,7 +809,7 @@ fn check_deprecated_options(matches: &getopts::Matches, dcx: &rustc_errors::Diag
     for &flag in deprecated_flags.iter() {
         if matches.opt_present(flag) {
             dcx.struct_warn(format!("the `{flag}` flag is deprecated"))
-                .note_mv(
+                .with_note(
                     "see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
                     for more information",
                 )
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 14df358be38..fa72758c216 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -501,9 +501,9 @@ impl<'tcx> Visitor<'tcx> for EmitIgnoredResolutionErrors<'tcx> {
                 E0433,
                 "failed to resolve: {label}",
             )
-            .span_label_mv(path.span, label)
-            .note_mv("this error was originally ignored because you are running `rustdoc`")
-            .note_mv("try running again with `rustc` or `cargo check` and you may get a more detailed error")
+            .with_span_label(path.span, label)
+            .with_note("this error was originally ignored because you are running `rustdoc`")
+            .with_note("try running again with `rustc` or `cargo check` and you may get a more detailed error")
             .emit();
         }
         // We could have an outer resolution that succeeded,
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 176494a3863..b843227d187 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -1228,7 +1228,7 @@ impl LinkCollector<'_, '_> {
             span,
             "linking to associated items of raw pointers is experimental",
         )
-        .note_mv("rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does")
+        .with_note("rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does")
         .emit();
     }
 
diff --git a/src/tools/clippy/clippy_config/src/msrvs.rs b/src/tools/clippy/clippy_config/src/msrvs.rs
index 76f3663f04f..dae9f09ec00 100644
--- a/src/tools/clippy/clippy_config/src/msrvs.rs
+++ b/src/tools/clippy/clippy_config/src/msrvs.rs
@@ -109,7 +109,7 @@ impl Msrv {
             if let Some(duplicate) = msrv_attrs.last() {
                 sess.dcx()
                     .struct_span_err(duplicate.span, "`clippy::msrv` is defined multiple times")
-                    .span_note_mv(msrv_attr.span, "first definition found here")
+                    .with_span_note(msrv_attr.span, "first definition found here")
                     .emit();
             }
 
diff --git a/src/tools/clippy/clippy_utils/src/attrs.rs b/src/tools/clippy/clippy_utils/src/attrs.rs
index 19d38903ade..ad8619f0d3d 100644
--- a/src/tools/clippy/clippy_utils/src/attrs.rs
+++ b/src/tools/clippy/clippy_utils/src/attrs.rs
@@ -136,7 +136,7 @@ pub fn get_unique_attr<'a>(
         if let Some(duplicate) = unique_attr {
             sess.dcx()
                 .struct_span_err(attr.span, format!("`{name}` is defined multiple times"))
-                .span_note_mv(duplicate.span, "first definition found here")
+                .with_span_note(duplicate.span, "first definition found here")
                 .emit();
         } else {
             unique_attr = Some(attr);