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]
# Disabling debug info speeds up builds a bunch,
# and we don't rely on it for debugging that much.
debug = 2
debug = 0
[profile.dev.package]
# These speed up local tests.

View File

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

View File

@ -493,10 +493,10 @@ fn print_type_ref(&mut self, type_ref: &TypeRef) {
w!(self, "]");
}
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");
w!(self, "fn(");
for (i, (name, typeref)) in args.iter().enumerate() {
for (i, (_, typeref)) in args.iter().enumerate() {
if i != 0 {
w!(self, ", ");
}
@ -509,7 +509,7 @@ fn print_type_ref(&mut self, type_ref: &TypeRef) {
w!(self, "...");
}
w!(self, ") -> ");
self.print_type_ref(&ret.1);
self.print_type_ref(&return_type);
}
TypeRef::Macro(_ast_id) => {
w!(self, "<macro>");

View File

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

View File

@ -239,7 +239,6 @@ impl<'a, T> fmt::Display for HirDisplayWrapper<'a, T>
T: HirDisplay,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
println!("formatting..");
match self.t.hir_fmt(&mut HirFormatter {
db: self.db,
fmt: f,
@ -341,10 +340,7 @@ fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
if f.should_truncate() {
return write!(f, "{}", TYPE_HINT_TRUNCATION);
}
let interner_kind = self.kind(Interner);
println!("interner kind: {interner_kind:?}");
match self.kind(Interner) {
TyKind::Never => write!(f, "!")?,
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())),
_ => None,
};
println!("definition: {definition:?}");
if let Some(markup) = render::definition(sema.db, definition, famous_defs.as_ref(), config) {
let mut res = HoverResult::default();
res.markup = render::process_markup(sema.db, definition, &markup, config);

View File

@ -411,7 +411,6 @@ fn label_and_docs<D>(db: &RootDatabase, def: D) -> (String, Option<hir::Document
D: HasAttrs + HirDisplay,
{
let label = def.display(db).to_string();
println!("label: {label:?}");
let docs = def.attrs(db).docs();
(label, docs)
}