lang: Allow seeds to have a trailing comma (#777)
This commit is contained in:
parent
22ef0aec42
commit
42ed126163
|
@ -281,7 +281,12 @@ fn generate_constraint_init_group(f: &Field, c: &ConstraintInitGroup) -> proc_ma
|
||||||
let seeds_with_nonce = match &c.seeds {
|
let seeds_with_nonce = match &c.seeds {
|
||||||
None => quote! {},
|
None => quote! {},
|
||||||
Some(c) => {
|
Some(c) => {
|
||||||
let s = &c.seeds;
|
let s = &mut c.seeds.clone();
|
||||||
|
// If the seeds came with a trailing comma, we need to chop it off
|
||||||
|
// before we interpolate them below.
|
||||||
|
if let Some(pair) = s.pop() {
|
||||||
|
s.push_value(pair.into_value());
|
||||||
|
}
|
||||||
let inner = match c.bump.as_ref() {
|
let inner = match c.bump.as_ref() {
|
||||||
// Bump target not given. Use the canonical bump.
|
// Bump target not given. Use the canonical bump.
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub struct TestTokenSeedsInit<'info> {
|
||||||
pub mint: Account<'info, Mint>,
|
pub mint: Account<'info, Mint>,
|
||||||
#[account(
|
#[account(
|
||||||
init,
|
init,
|
||||||
seeds = [b"my-token-seed".as_ref()],
|
seeds = [b"my-token-seed".as_ref(),],
|
||||||
bump = token_bump,
|
bump = token_bump,
|
||||||
payer = authority,
|
payer = authority,
|
||||||
token::mint = mint,
|
token::mint = mint,
|
||||||
|
|
Loading…
Reference in New Issue