Makes output code a lot more readable, if two strings are next to each other they get combined.
QPZ6QNIEGMSQWN65HB7T44HUM42XSXZ6F5JOWEOTFPNDP2PQEKKQC
let expressions = inlines
.into_iter()
.map(transform_inline)
.collect::<Vec<_>>();
let expressions =
inlines
.into_iter()
.map(transform_inline)
.fold(Vec::new(), |mut state, inline| {
if let syn::Expr::Lit(current_literal) = &inline {
if let Some(syn::Expr::Lit(ref mut prev_literal)) = state.last_mut() {
let prev_string = extract_literal_string(&prev_literal);
let current_string = extract_literal_string(¤t_literal);
let merged_string = prev_string + ¤t_string;
*prev_literal = literal_string(merged_string.as_str());
return state;
}
}