Skip to content

Commit 70446e5

Browse files
MikuroXinaemilio
authored andcommitted
Shorten patterns
1 parent f21f6f3 commit 70446e5

File tree

1 file changed

+13
-71
lines changed

1 file changed

+13
-71
lines changed

src/ir/context.rs

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -831,83 +831,25 @@ If you encounter an error missing from this list, please file an issue or a PR!"
831831
// TODO: Move all this syntax crap to other part of the code.
832832

833833
/// Mangles a name so it doesn't conflict with any keyword.
834+
#[rustfmt::skip]
834835
pub fn rust_mangle<'a>(&self, name: &'a str) -> Cow<'a, str> {
835836
if name.contains('@') ||
836837
name.contains('?') ||
837838
name.contains('$') ||
838839
matches!(
839840
name,
840-
"abstract" |
841-
"alignof" |
842-
"as" |
843-
"async" |
844-
"become" |
845-
"box" |
846-
"break" |
847-
"const" |
848-
"continue" |
849-
"crate" |
850-
"do" |
851-
"dyn" |
852-
"else" |
853-
"enum" |
854-
"extern" |
855-
"false" |
856-
"final" |
857-
"fn" |
858-
"for" |
859-
"if" |
860-
"impl" |
861-
"in" |
862-
"let" |
863-
"loop" |
864-
"macro" |
865-
"match" |
866-
"mod" |
867-
"move" |
868-
"mut" |
869-
"offsetof" |
870-
"override" |
871-
"priv" |
872-
"proc" |
873-
"pub" |
874-
"pure" |
875-
"ref" |
876-
"return" |
877-
"Self" |
878-
"self" |
879-
"sizeof" |
880-
"static" |
881-
"struct" |
882-
"super" |
883-
"trait" |
884-
"true" |
885-
"type" |
886-
"typeof" |
887-
"unsafe" |
888-
"unsized" |
889-
"use" |
890-
"virtual" |
891-
"where" |
892-
"while" |
893-
"yield" |
894-
"str" |
895-
"bool" |
896-
"f32" |
897-
"f64" |
898-
"usize" |
899-
"isize" |
900-
"u128" |
901-
"i128" |
902-
"u64" |
903-
"i64" |
904-
"u32" |
905-
"i32" |
906-
"u16" |
907-
"i16" |
908-
"u8" |
909-
"i8" |
910-
"_"
841+
"abstract" | "alignof" | "as" | "async" | "become" |
842+
"box" | "break" | "const" | "continue" | "crate" | "do" |
843+
"dyn" | "else" | "enum" | "extern" | "false" | "final" |
844+
"fn" | "for" | "if" | "impl" | "in" | "let" | "loop" |
845+
"macro" | "match" | "mod" | "move" | "mut" | "offsetof" |
846+
"override" | "priv" | "proc" | "pub" | "pure" | "ref" |
847+
"return" | "Self" | "self" | "sizeof" | "static" |
848+
"struct" | "super" | "trait" | "true" | "type" | "typeof" |
849+
"unsafe" | "unsized" | "use" | "virtual" | "where" |
850+
"while" | "yield" | "str" | "bool" | "f32" | "f64" |
851+
"usize" | "isize" | "u128" | "i128" | "u64" | "i64" |
852+
"u32" | "i32" | "u16" | "i16" | "u8" | "i8" | "_"
911853
)
912854
{
913855
let mut s = name.to_owned();

0 commit comments

Comments
 (0)