summaryrefslogtreecommitdiffstats
path: root/vendor/syn/src/ext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/syn/src/ext.rs')
-rw-r--r--vendor/syn/src/ext.rs8
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()
}