diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/syn/src/ext.rs | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/syn/src/ext.rs')
-rw-r--r-- | vendor/syn/src/ext.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/vendor/syn/src/ext.rs b/vendor/syn/src/ext.rs index 98d5550f4..9ee567251 100644 --- a/vendor/syn/src/ext.rs +++ b/vendor/syn/src/ext.rs @@ -1,6 +1,4 @@ //! Extension traits to provide parsing methods on foreign types. -//! -//! *This module is available only if Syn is built with the `"parsing"` feature.* use crate::buffer::Cursor; use crate::parse::Peek; @@ -13,8 +11,6 @@ use proc_macro2::Ident; /// /// This trait is sealed and cannot be implemented for types outside of Syn. It /// is implemented only for `proc_macro2::Ident`. -/// -/// *This trait is available only if Syn is built with the `"parsing"` feature.* pub trait IdentExt: Sized + private::Sealed { /// Parses any identifier including keywords. /// @@ -96,8 +92,8 @@ impl IdentExt for Ident { fn unraw(&self) -> Ident { let string = self.to_string(); - if string.starts_with("r#") { - Ident::new(&string[2..], self.span()) + if let Some(string) = string.strip_prefix("r#") { + Ident::new(string, self.span()) } else { self.clone() } |