This commit is contained in:
Jeroen Vannevel 2022-02-15 14:47:23 +00:00
parent 73e49493bd
commit c450d0ce41
No known key found for this signature in database
GPG Key ID: 78EF5F52F38C49BD
7 changed files with 7 additions and 18 deletions

View File

@ -5,7 +5,7 @@ exclude = ["crates/proc_macro_test/imp"]
[profile.dev] [profile.dev]
# Disabling debug info speeds up builds a bunch, # Disabling debug info speeds up builds a bunch,
# and we don't rely on it for debugging that much. # and we don't rely on it for debugging that much.
debug = 2 debug = 0
[profile.dev.package] [profile.dev.package]
# These speed up local tests. # These speed up local tests.

View File

@ -22,9 +22,7 @@ use crate::{
impl HirDisplay for Function { impl HirDisplay for Function {
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
println!("Formatting for Function");
let data = f.db.function_data(self.id); let data = f.db.function_data(self.id);
println!("data: {:?}", &data);
write_visibility(self.module(f.db).id, self.visibility(f.db), f)?; write_visibility(self.module(f.db).id, self.visibility(f.db), f)?;
if data.is_default() { if data.is_default() {
write!(f, "default ")?; write!(f, "default ")?;
@ -463,7 +461,6 @@ impl HirDisplay for Trait {
impl HirDisplay for TypeAlias { impl HirDisplay for TypeAlias {
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
println!("Formatting for TypeAlias");
write_visibility(self.module(f.db).id, self.visibility(f.db), f)?; write_visibility(self.module(f.db).id, self.visibility(f.db), f)?;
let data = f.db.type_alias_data(self.id); let data = f.db.type_alias_data(self.id);
write!(f, "type {}", data.name)?; write!(f, "type {}", data.name)?;
@ -471,7 +468,6 @@ impl HirDisplay for TypeAlias {
write!(f, ": ")?; write!(f, ": ")?;
f.write_joined(&data.bounds, " + ")?; f.write_joined(&data.bounds, " + ")?;
} }
println!("type_ref: {:?}", &data.type_ref);
if let Some(ty) = &data.type_ref { if let Some(ty) = &data.type_ref {
write!(f, " = ")?; write!(f, " = ")?;
ty.hir_fmt(f)?; ty.hir_fmt(f)?;

View File

@ -493,10 +493,10 @@ impl<'a> Printer<'a> {
w!(self, "]"); w!(self, "]");
} }
TypeRef::Fn(args_and_ret, varargs) => { TypeRef::Fn(args_and_ret, varargs) => {
let (ret, args) = let ((_, return_type), args) =
args_and_ret.split_last().expect("TypeRef::Fn is missing return type"); args_and_ret.split_last().expect("TypeRef::Fn is missing return type");
w!(self, "fn("); w!(self, "fn(");
for (i, (name, typeref)) in args.iter().enumerate() { for (i, (_, typeref)) in args.iter().enumerate() {
if i != 0 { if i != 0 {
w!(self, ", "); w!(self, ", ");
} }
@ -509,7 +509,7 @@ impl<'a> Printer<'a> {
w!(self, "..."); w!(self, "...");
} }
w!(self, ") -> "); w!(self, ") -> ");
self.print_type_ref(&ret.1); self.print_type_ref(&return_type);
} }
TypeRef::Macro(_ast_id) => { TypeRef::Macro(_ast_id) => {
w!(self, "<macro>"); w!(self, "<macro>");

View File

@ -189,10 +189,9 @@ impl TypeRef {
} }
pl.params().map(|p| (p.pat(), p.ty())).map(|it| { pl.params().map(|p| (p.pat(), p.ty())).map(|it| {
println!("{it:?}");
let type_ref = TypeRef::from_ast_opt(ctx, it.1); let type_ref = TypeRef::from_ast_opt(ctx, it.1);
let name = it.0.unwrap().syntax().text().to_string(); let name = if it.0.is_some() { Some(it.0.unwrap().syntax().text().to_string()) } else { None };
(Some(name), type_ref) (name, type_ref)
}).collect() }).collect()
} else { } else {
Vec::new() Vec::new()

View File

@ -239,7 +239,6 @@ where
T: HirDisplay, T: HirDisplay,
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
println!("formatting..");
match self.t.hir_fmt(&mut HirFormatter { match self.t.hir_fmt(&mut HirFormatter {
db: self.db, db: self.db,
fmt: f, fmt: f,
@ -341,10 +340,7 @@ impl HirDisplay for Ty {
if f.should_truncate() { if f.should_truncate() {
return write!(f, "{}", TYPE_HINT_TRUNCATION); return write!(f, "{}", TYPE_HINT_TRUNCATION);
} }
let interner_kind = self.kind(Interner);
println!("interner kind: {interner_kind:?}");
match self.kind(Interner) { match self.kind(Interner) {
TyKind::Never => write!(f, "!")?, TyKind::Never => write!(f, "!")?,
TyKind::Str => write!(f, "str")?, TyKind::Str => write!(f, "str")?,

View File

@ -172,7 +172,6 @@ pub(crate) fn hover_for_definition(
Definition::BuiltinType(_) => Some(FamousDefs(sema, sema.scope(node).krate())), Definition::BuiltinType(_) => Some(FamousDefs(sema, sema.scope(node).krate())),
_ => None, _ => None,
}; };
println!("definition: {definition:?}");
if let Some(markup) = render::definition(sema.db, definition, famous_defs.as_ref(), config) { if let Some(markup) = render::definition(sema.db, definition, famous_defs.as_ref(), config) {
let mut res = HoverResult::default(); let mut res = HoverResult::default();
res.markup = render::process_markup(sema.db, definition, &markup, config); res.markup = render::process_markup(sema.db, definition, &markup, config);

View File

@ -411,7 +411,6 @@ where
D: HasAttrs + HirDisplay, D: HasAttrs + HirDisplay,
{ {
let label = def.display(db).to_string(); let label = def.display(db).to_string();
println!("label: {label:?}");
let docs = def.attrs(db).docs(); let docs = def.attrs(db).docs();
(label, docs) (label, docs)
} }