update SyntaxShape::OneOf Display impl

This commit is contained in:
Bahex 2025-05-02 08:04:56 +03:00
parent 70dc4a3006
commit 6dfb7912f5

View File

@ -250,9 +250,14 @@ impl Display for SyntaxShape {
SyntaxShape::Error => write!(f, "error"), SyntaxShape::Error => write!(f, "error"),
SyntaxShape::CompleterWrapper(x, _) => write!(f, "completable<{x}>"), SyntaxShape::CompleterWrapper(x, _) => write!(f, "completable<{x}>"),
SyntaxShape::OneOf(list) => { SyntaxShape::OneOf(list) => {
let arg_vec: Vec<_> = list.iter().map(|x| x.to_string()).collect(); write!(f, "(")?;
let arg_string = arg_vec.join(", "); if let Some((last, rest)) = list.split_last() {
write!(f, "one_of({arg_string})") for ty in rest {
write!(f, "{ty} | ")?;
}
write!(f, "{last}")?;
}
write!(f, ")")
} }
SyntaxShape::Nothing => write!(f, "nothing"), SyntaxShape::Nothing => write!(f, "nothing"),
} }