Skip to content

Commit

Permalink
Add default implementation for HirWrite methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lowr committed Jul 28, 2023
1 parent b517aee commit 104d707
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions crates/hir-ty/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,15 @@ use crate::{
};

pub trait HirWrite: fmt::Write {
fn start_location_link(&mut self, location: ModuleDefId);
fn end_location_link(&mut self);
fn start_location_link(&mut self, _location: ModuleDefId) {}
fn end_location_link(&mut self) {}
}

// String will ignore link metadata
impl HirWrite for String {
fn start_location_link(&mut self, _: ModuleDefId) {}

fn end_location_link(&mut self) {}
}
impl HirWrite for String {}

// `core::Formatter` will ignore metadata
impl HirWrite for fmt::Formatter<'_> {
fn start_location_link(&mut self, _: ModuleDefId) {}
fn end_location_link(&mut self) {}
}
impl HirWrite for fmt::Formatter<'_> {}

pub struct HirFormatter<'a> {
pub db: &'a dyn HirDatabase,
Expand Down

0 comments on commit 104d707

Please sign in to comment.