cleanup imports

This commit is contained in:
Aleksey Kladov 2021-12-27 15:03:05 +03:00
parent 23ce31e836
commit d3ba55bd06

View file

@ -61,18 +61,17 @@
use std::rc::Rc; use std::rc::Rc;
use parser::ParserEntryPoint;
use smallvec::{smallvec, SmallVec};
use syntax::SmolStr;
use crate::{ use crate::{
expander::{Binding, Bindings, Fragment}, expander::{Binding, Bindings, ExpandResult, Fragment},
parser::{Op, RepeatKind, Separator}, parser::{Op, RepeatKind, Separator},
tt_iter::TtIter, tt_iter::TtIter,
ExpandError, MetaTemplate, ExpandError, MetaTemplate,
}; };
use super::ExpandResult;
use parser::ParserEntryPoint::*;
use smallvec::{smallvec, SmallVec};
use syntax::SmolStr;
impl Bindings { impl Bindings {
fn push_optional(&mut self, name: &SmolStr) { fn push_optional(&mut self, name: &SmolStr) {
// FIXME: Do we have a better way to represent an empty token ? // FIXME: Do we have a better way to represent an empty token ?
@ -691,14 +690,14 @@ fn match_leaf(lhs: &tt::Leaf, src: &mut TtIter) -> Result<(), ExpandError> {
fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragment>> { fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragment>> {
let fragment = match kind { let fragment = match kind {
"path" => Path, "path" => ParserEntryPoint::Path,
"expr" => Expr, "expr" => ParserEntryPoint::Expr,
"ty" => Type, "ty" => ParserEntryPoint::Type,
"pat" | "pat_param" => Pattern, // FIXME: edition2021 "pat" | "pat_param" => ParserEntryPoint::Pattern, // FIXME: edition2021
"stmt" => Statement, "stmt" => ParserEntryPoint::Statement,
"block" => Block, "block" => ParserEntryPoint::Block,
"meta" => MetaItem, "meta" => ParserEntryPoint::MetaItem,
"item" => Item, "item" => ParserEntryPoint::Item,
_ => { _ => {
let tt_result = match kind { let tt_result = match kind {
"ident" => input "ident" => input
@ -896,7 +895,7 @@ impl<'a> TtIter<'a> {
} }
fn eat_vis(&mut self) -> Option<tt::TokenTree> { fn eat_vis(&mut self) -> Option<tt::TokenTree> {
self.expect_fragment(Visibility).value self.expect_fragment(ParserEntryPoint::Visibility).value
} }
fn eat_char(&mut self, c: char) -> Option<tt::TokenTree> { fn eat_char(&mut self, c: char) -> Option<tt::TokenTree> {