From a3de39a35ad0399fcb984fed0fb828b3a2887828 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 4 Jan 2021 11:13:51 -0800 Subject: [PATCH] repo: inline init_cycles() now that it's very short The function used to be larger when we had more reference cycles between e.g. the `WorkingCopy` and `Repo`. Now there's only `Evolution` left, so let's inline the function. --- lib/src/repo.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/src/repo.rs b/lib/src/repo.rs index a6836b59a..344b35724 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -183,8 +183,8 @@ impl ReadonlyRepo { IndexFile::init(repo_path.join("index")); let evolution = ReadonlyEvolution::new(static_lifetime_repo); + Arc::get_mut(&mut repo).unwrap().evolution = Some(evolution); - ReadonlyRepo::init_cycles(&mut repo, evolution); repo.working_copy_locked() .check_out(checkout_commit) .expect("failed to check out root commit"); @@ -237,15 +237,10 @@ impl ReadonlyRepo { let repo_ref: &ReadonlyRepo = repo.as_ref(); let static_lifetime_repo: &'static ReadonlyRepo = unsafe { std::mem::transmute(repo_ref) }; let evolution = ReadonlyEvolution::new(static_lifetime_repo); - ReadonlyRepo::init_cycles(&mut repo, evolution); + Arc::get_mut(&mut repo).unwrap().evolution = Some(evolution); Ok(repo) } - fn init_cycles(mut repo: &mut Arc, evolution: ReadonlyEvolution<'static>) { - let mut repo_ref_mut = Arc::get_mut(&mut repo).unwrap(); - repo_ref_mut.evolution = Some(evolution); - } - pub fn repo_path(&self) -> &PathBuf { &self.repo_path }