From c450d0ce411acaf48ff7aabe393020df6e60f378 Mon Sep 17 00:00:00 2001 From: Jeroen Vannevel Date: Tue, 15 Feb 2022 14:47:23 +0000 Subject: [PATCH] cleanup --- Cargo.toml | 2 +- crates/hir/src/display.rs | 4 ---- crates/hir_def/src/item_tree/pretty.rs | 6 +++--- crates/hir_def/src/type_ref.rs | 5 ++--- crates/hir_ty/src/display.rs | 6 +----- crates/ide/src/hover.rs | 1 - crates/ide/src/hover/render.rs | 1 - 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1b322acdc61..3f83041bec0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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. diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index 19402c1c258..1e949771ea0 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs @@ -22,9 +22,7 @@ use crate::{ 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 @@ impl HirDisplay for Trait { 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 @@ impl HirDisplay for TypeAlias { 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)?; diff --git a/crates/hir_def/src/item_tree/pretty.rs b/crates/hir_def/src/item_tree/pretty.rs index 4d57e484c1f..0df6e97dd46 100644 --- a/crates/hir_def/src/item_tree/pretty.rs +++ b/crates/hir_def/src/item_tree/pretty.rs @@ -493,10 +493,10 @@ impl<'a> Printer<'a> { 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 @@ impl<'a> Printer<'a> { w!(self, "..."); } w!(self, ") -> "); - self.print_type_ref(&ret.1); + self.print_type_ref(&return_type); } TypeRef::Macro(_ast_id) => { w!(self, ""); diff --git a/crates/hir_def/src/type_ref.rs b/crates/hir_def/src/type_ref.rs index 3c2e036ab95..8667e0a7d6d 100644 --- a/crates/hir_def/src/type_ref.rs +++ b/crates/hir_def/src/type_ref.rs @@ -189,10 +189,9 @@ impl TypeRef { } 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() diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index bca628a5c88..ad330d6261c 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -239,7 +239,6 @@ where 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 @@ impl HirDisplay for Ty { 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")?, diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 550e1c15430..0eba0b09ba6 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -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); diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs index 0a5c335661d..f94348ec581 100644 --- a/crates/ide/src/hover/render.rs +++ b/crates/ide/src/hover/render.rs @@ -411,7 +411,6 @@ where D: HasAttrs + HirDisplay, { let label = def.display(db).to_string(); - println!("label: {label:?}"); let docs = def.attrs(db).docs(); (label, docs) }