1
Fork 0

ast: remove implicit pprust dependency via Display.

Instead just use `pprust::path_to_string(..)` where needed.

This has two benefits:

a) The AST definition is now independent of printing it.
   (Therefore we get closer to extracting a data-crate.)

b) Debugging should be easier as program flow is clearer.
This commit is contained in:
Mazdak Farrokhzad 2019-10-08 22:17:46 +02:00
parent d131abefc3
commit 742ec4b9bf
15 changed files with 88 additions and 47 deletions

View file

@ -46,6 +46,7 @@ use serialize::json::{ToJson, Json, as_json};
use syntax::ast;
use syntax::edition::Edition;
use syntax::ext::base::MacroKind;
use syntax::print::pprust;
use syntax::source_map::FileName;
use syntax::feature_gate::UnstableFeatures;
use syntax::symbol::{Symbol, sym};
@ -2957,7 +2958,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum) {
}
fn render_attribute(attr: &ast::MetaItem) -> Option<String> {
let path = attr.path.to_string();
let path = pprust::path_to_string(&attr.path);
if attr.is_word() {
Some(path)