Change to add 1 if non zero shift

This commit is contained in:
Edwin Cheng 2019-11-05 01:16:06 +08:00
parent 188a1412b9
commit a5839662f4

View File

@ -108,7 +108,7 @@ impl MacroRules {
// Note that TokenId is started from zero,
// We have to add 1 to prevent duplication.
let shift = max_id(tt).unwrap_or(0) + 1;
let shift = max_id(tt).map_or(0, |it| it + 1);
Ok(MacroRules { rules, shift })
}