Add default implementation for HirWrite methods

This commit is contained in:
Ryo Yoshida 2023-07-28 19:11:55 +09:00
parent b517aeeca5
commit 104d707d6a
No known key found for this signature in database
GPG Key ID: E25698A930586171

View File

@ -48,22 +48,15 @@
};
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,