Skip to content

Commit 1656112

Browse files
committed
refac(macro): Change if condition
1 parent 5353153 commit 1656112

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

crates/macros/src/parsing.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,11 @@ impl MethodRename for &str {
118118
RenameRule::None => self.to_string(),
119119
_ => {
120120
if MAGIC_METHOD.contains(self) {
121-
if self == &MAGIC_METHOD[12] {
122-
"__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()
121+
match *self {
122+
"__to_string" => "__toString".to_string(),
123+
"__debug_info" => "__debugInfo".to_string(),
124+
"__call_static" => "__callStatic".to_string(),
125+
_ => self.to_string(),
129126
}
130127
} else {
131128
self.rename(rule)

0 commit comments

Comments
 (0)