We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6cb935 commit 360ae34Copy full SHA for 360ae34
crates/macros/src/parsing.rs
@@ -114,12 +114,23 @@ impl MethodRename for syn::Ident {
114
115
impl MethodRename for &str {
116
fn rename_method(&self, rule: &RenameRule) -> String {
117
- let s = self.to_string();
118
-
119
- if MAGIC_METHOD.contains(&s.as_str()) {
120
- s
121
- } else {
122
- self.rename(rule)
+ match rule {
+ RenameRule::None => self.to_string(),
+ _ => {
+ if MAGIC_METHOD.contains(self) {
+ if self == &MAGIC_METHOD[12] {
+ "__toString".to_string()
123
+ } else if self == &MAGIC_METHOD[16] {
124
+ "__debugInfo".to_string()
125
+ } else if self == &MAGIC_METHOD[3] {
126
+ "__callStatic".to_string()
127
+ } else {
128
+ self.to_string()
129
+ }
130
131
+ self.rename(rule)
132
133
134
}
135
136
0 commit comments