Fix plain string

This commit is contained in:
harupy 2022-12-10 18:09:26 +09:00
parent dd01ab1c9e
commit 9111cd8a3d
4 changed files with 8 additions and 10 deletions

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 8,
column: 16,
},
),
custom: (),

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 8,
column: 17,
},
),
custom: (),

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 9,
column: 17,
},
),
custom: (),

View file

@ -82,18 +82,16 @@ pub fn parse_strings(
deduped.push(take_current(&mut current));
}
Ok(if has_fstring {
Expr::new(
initial_start,
last_end,
ExprKind::JoinedStr { values: deduped },
)
let node = if has_fstring {
ExprKind::JoinedStr { values: deduped }
} else {
deduped
.into_iter()
.exactly_one()
.expect("String must be concatenated to a single element.")
})
.node
};
Ok(Expr::new(initial_start, last_end, node))
}
#[cfg(test)]