mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-08 05:35:22 +00:00
Use try_from
This commit is contained in:
parent
fd8468c5eb
commit
9efa872023
1 changed files with 2 additions and 2 deletions
|
@ -244,12 +244,12 @@ where
|
|||
// Detect potential string like rb'' b'' f'' u'' r''
|
||||
match self.window[..3] {
|
||||
[Some(c), Some('"' | '\''), ..] => {
|
||||
if let Ok(kind) = c.to_string().try_into() {
|
||||
if let Ok(kind) = StringKind::try_from(c.to_string()) {
|
||||
return self.lex_string(kind);
|
||||
}
|
||||
}
|
||||
[Some(c1), Some(c2), Some('"' | '\'')] => {
|
||||
if let Ok(kind) = format!("{c1}{c2}").try_into() {
|
||||
if let Ok(kind) = StringKind::try_from(format!("{c1}{c2}")) {
|
||||
return self.lex_string(kind);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue