repo: move base_repo() off of Repo trait

We only ever call `base_repo()` on `MutableRepo` instances.
This commit is contained in:
Martin von Zweigbergk 2023-03-20 22:59:12 -07:00 committed by Martin von Zweigbergk
parent ea498df539
commit d089c22232

View file

@ -46,8 +46,6 @@ use crate::view::{RefName, View};
use crate::{backend, op_store};
pub trait Repo {
fn base_repo(&self) -> &Arc<ReadonlyRepo>;
fn store(&self) -> &Arc<Store>;
fn op_store(&self) -> &Arc<dyn OpStore>;
@ -262,10 +260,6 @@ impl ReadonlyRepo {
}
impl Repo for Arc<ReadonlyRepo> {
fn base_repo(&self) -> &Arc<ReadonlyRepo> {
self
}
fn store(&self) -> &Arc<Store> {
&self.store
}
@ -648,6 +642,10 @@ impl MutableRepo {
}
}
pub fn base_repo(&self) -> &Arc<ReadonlyRepo> {
&self.base_repo
}
fn view_mut(&mut self) -> &mut View {
self.view.get_mut()
}
@ -1134,10 +1132,6 @@ impl MutableRepo {
}
impl Repo for MutableRepo {
fn base_repo(&self) -> &Arc<ReadonlyRepo> {
&self.base_repo
}
fn store(&self) -> &Arc<Store> {
self.base_repo.store()
}