about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/context/diagnostics.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-07 19:38:05 -0400
committerMichael Goulet <michael@errs.io>2024-04-09 14:06:09 -0400
commit3253c021cbd3bca49393db6a2372764ec53f5920 (patch)
treeaa98877babf4fc35d688b15a02b963ec774a0e6f /compiler/rustc_lint/src/context/diagnostics.rs
parenta439eb259da620fa95c67c0c6e89f196bcb61f08 (diff)
downloadrust-3253c021cbd3bca49393db6a2372764ec53f5920.tar.gz
rust-3253c021cbd3bca49393db6a2372764ec53f5920.zip
Add a helper for extending a span to include any trailing whitespace
Diffstat (limited to 'compiler/rustc_lint/src/context/diagnostics.rs')
-rw-r--r--compiler/rustc_lint/src/context/diagnostics.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/context/diagnostics.rs b/compiler/rustc_lint/src/context/diagnostics.rs
index e2010ab3830..16e3b8c11c1 100644
--- a/compiler/rustc_lint/src/context/diagnostics.rs
+++ b/compiler/rustc_lint/src/context/diagnostics.rs
@@ -215,10 +215,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiag, diag: &mut Di
             if let Some(deletion_span) = deletion_span {
                 let msg = "elide the single-use lifetime";
                 let (use_span, replace_lt) = if elide {
-                    let use_span = sess
-                        .source_map()
-                        .span_extend_while(use_span, char::is_whitespace)
-                        .unwrap_or(use_span);
+                    let use_span = sess.source_map().span_extend_while_whitespace(use_span);
                     (use_span, String::new())
                 } else {
                     (use_span, "'_".to_owned())