Rename ast::Lit as ast::MetaItemLit.
This commit is contained in:
@@ -527,14 +527,19 @@ pub(crate) trait MetaVisitor<'ast> {
|
||||
|
||||
fn visit_meta_word(&mut self, _meta_item: &'ast ast::MetaItem) {}
|
||||
|
||||
fn visit_meta_name_value(&mut self, _meta_item: &'ast ast::MetaItem, _lit: &'ast ast::Lit) {}
|
||||
fn visit_meta_name_value(
|
||||
&mut self,
|
||||
_meta_item: &'ast ast::MetaItem,
|
||||
_lit: &'ast ast::MetaItemLit,
|
||||
) {
|
||||
}
|
||||
|
||||
fn visit_nested_meta_item(&mut self, nm: &'ast ast::NestedMetaItem) {
|
||||
match nm {
|
||||
ast::NestedMetaItem::MetaItem(ref meta_item) => self.visit_meta_item(meta_item),
|
||||
ast::NestedMetaItem::Literal(ref lit) => self.visit_literal(lit),
|
||||
ast::NestedMetaItem::Literal(ref lit) => self.visit_meta_item_lit(lit),
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_literal(&mut self, _lit: &'ast ast::Lit) {}
|
||||
fn visit_meta_item_lit(&mut self, _lit: &'ast ast::MetaItemLit) {}
|
||||
}
|
||||
|
||||
@@ -84,15 +84,19 @@ impl PathVisitor {
|
||||
}
|
||||
|
||||
impl<'ast> MetaVisitor<'ast> for PathVisitor {
|
||||
fn visit_meta_name_value(&mut self, meta_item: &'ast ast::MetaItem, lit: &'ast ast::Lit) {
|
||||
fn visit_meta_name_value(
|
||||
&mut self,
|
||||
meta_item: &'ast ast::MetaItem,
|
||||
lit: &'ast ast::MetaItemLit,
|
||||
) {
|
||||
if meta_item.has_name(Symbol::intern("path")) && lit.kind.is_str() {
|
||||
self.paths.push(lit_to_str(lit));
|
||||
self.paths.push(meta_item_lit_to_str(lit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn lit_to_str(lit: &ast::Lit) -> String {
|
||||
fn meta_item_lit_to_str(lit: &ast::MetaItemLit) -> String {
|
||||
match lit.kind {
|
||||
ast::LitKind::Str(symbol, ..) => symbol.to_string(),
|
||||
_ => unreachable!(),
|
||||
@@ -100,7 +104,7 @@ fn lit_to_str(lit: &ast::Lit) -> String {
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn lit_to_str(lit: &ast::Lit) -> String {
|
||||
fn meta_item_lit_to_str(lit: &ast::MetaItemLit) -> String {
|
||||
match lit.kind {
|
||||
ast::LitKind::Str(symbol, ..) => symbol.as_str().replace("/", "\\"),
|
||||
_ => unreachable!(),
|
||||
|
||||
Reference in New Issue
Block a user