mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-26 13:24:42 +00:00
Use match
This commit is contained in:
parent
51b7dbb89c
commit
96a50810a6
1 changed files with 1 additions and 1 deletions
|
@ -15,7 +15,7 @@ pub fn parse_strings(
|
||||||
let initial_kind = (values[0].1 .1 == StringKind::U).then(|| "u".to_owned());
|
let initial_kind = (values[0].1 .1 == StringKind::U).then(|| "u".to_owned());
|
||||||
|
|
||||||
// Optimization: fast-track the common case of a single string.
|
// Optimization: fast-track the common case of a single string.
|
||||||
if values.len() == 1 && matches!(&values[0].1 .1, StringKind::Normal | StringKind::U) {
|
if matches!(&*values, [(_, (_, StringKind::Normal | StringKind::U), _)]) {
|
||||||
let value = values.into_iter().last().unwrap().1 .0;
|
let value = values.into_iter().last().unwrap().1 .0;
|
||||||
return Ok(Expr::new(
|
return Ok(Expr::new(
|
||||||
initial_start,
|
initial_start,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue