MCPcopy Create free account
hub / github.com/dtolnay/thiserror / to_local

Method to_local

impl/src/unraw.rs:19–30  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

17 }
18
19 pub fn to_local(&self) -> Ident {
20 let unraw = self.0.unraw();
21 let repr = unraw.to_string();
22 if syn::parse_str::<Ident>(&repr).is_err() {
23 if let "_" | "super" | "self" | "Self" | "crate" = repr.as_str() {
24 // Some identifiers are never allowed to appear as raw, like r#self and r#_.
25 } else {
26 return Ident::new_raw(&repr, Span::call_site());
27 }
28 }
29 unraw
30 }
31
32 pub fn set_span(&mut self, span: Span) {
33 self.0.set_span(span);

Callers 3

expand_shorthandMethod · 0.80
impl_enumFunction · 0.80
to_tokensMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected