Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requestty-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ proc-macro = true

[dependencies]
proc-macro2 = "1"
syn = { version = "1", features = ["full"] }
syn = "2"
quote = "1"
bitflags = "1.3"
rustversion = "1.0"
6 changes: 4 additions & 2 deletions requestty-macro/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ impl Choices {
let content;
syn::bracketed!(content in input);

content.parse_terminated(parser).map(Choices::Array)
content
.parse_terminated(parser, Token![,])
.map(Choices::Array)
} else {
input.parse().map(Choices::Expr)
}
Expand Down Expand Up @@ -205,7 +207,7 @@ fn make_into(expr: syn::Expr) -> syn::Expr {
attrs: Vec::new(),
qself: None,
path: syn::Path {
leading_colon: Some(syn::token::Colon2(expr.span())),
leading_colon: Some(syn::token::PathSep(expr.span())),
segments: from_path_segments,
},
}
Expand Down
2 changes: 1 addition & 1 deletion requestty-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Parse for Questions {

Ok(Self {
inline,
questions: input.parse_terminated(Question::parse)?,
questions: input.parse_terminated(Question::parse, Token![,])?,
})
}
}
7 changes: 4 additions & 3 deletions requestty-macro/src/question.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,17 @@ impl Parse for Question {
if let QuestionKind::Custom = kind {
if opts.prompt.is_none() {
return Err(syn::Error::new(
brace.span,
brace.span.join(),
"missing required option `prompt`",
));
}
}

Ok(Self {
kind,
name: name
.ok_or_else(|| syn::Error::new(brace.span, "missing required option `name`"))?,
name: name.ok_or_else(|| {
syn::Error::new(brace.span.join(), "missing required option `name`")
})?,
opts,
})
}
Expand Down
Loading