about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-11-24 00:17:35 +0000
committerbors <bors@rust-lang.org>2022-11-24 00:17:35 +0000
commit872631d0f0fadffe3220ab1bd9c8f1f2342341e2 (patch)
tree6721d534b4d7f5b0e7c364c451ffb6b792bfdea7 /compiler/rustc_parse/src/parser
parent70f8737b2f5d3bf7d6b784fad00b663b7ff9feda (diff)
parent94470f4efd2ec0786dd1f201e9ea84651b4bb0d0 (diff)
downloadrust-872631d0f0fadffe3220ab1bd9c8f1f2342341e2.tar.gz
rust-872631d0f0fadffe3220ab1bd9c8f1f2342341e2.zip
Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiser
Use `as_deref` in compiler (but only where it makes sense)

This simplifies some code :3

(there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 94c83503dc9..3f5baf343c9 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -2565,7 +2565,7 @@ impl<'a> Parser<'a> {
             if let [a, b] = segments {
                 let (a_span, b_span) = (a.span(), b.span());
                 let between_span = a_span.shrink_to_hi().to(b_span.shrink_to_lo());
-                if self.span_to_snippet(between_span).as_ref().map(|a| &a[..]) == Ok(":: ") {
+                if self.span_to_snippet(between_span).as_deref() == Ok(":: ") {
                     return Err(DoubleColonInBound {
                         span: path.span.shrink_to_hi(),
                         between: between_span,