Skip to content

Commit 39987fb

Browse files
fix: resolve cargo check errors and warnings
These were introduced by the change to edition 2024 and rust 1.86 Authored with support from Zed AI using Claude Sonnet 4.5 - find_subtree_roots has been dead code for 3.5 years! - see `git log -S find_subtree_roots` - see dd45eb8
1 parent 917ad5d commit 39987fb

File tree

3 files changed

+6
-28
lines changed
  • git-branchless-invoke/src
  • git-branchless-lib/src/git
  • git-branchless-reword/src

3 files changed

+6
-28
lines changed

git-branchless-invoke/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ fn install_tracing(effects: Effects) -> eyre::Result<impl Drop> {
6969
Ok(nesting_level) => nesting_level.parse::<usize>().unwrap_or_default(),
7070
Err(_) => 0,
7171
};
72-
std::env::set_var(NESTING_LEVEL_KEY, (nesting_level + 1).to_string());
72+
// SAFETY: We're setting an environment variable that we control and read immediately
73+
// after. This is done at the start of execution before any threading occurs.
74+
unsafe {
75+
std::env::set_var(NESTING_LEVEL_KEY, (nesting_level + 1).to_string());
76+
}
7377

7478
let should_include_function_args = match std::env::var("RUST_PROFILE_INCLUDE_ARGS") {
7579
Ok(value) if !value.is_empty() => true,

git-branchless-lib/src/git/repo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ impl Repo {
15401540
let mut result = self.get_paths_touched_by_commit(parent_commit)?;
15411541
match opts {
15421542
AmendFastOptions::FromIndex { paths } => result.extend(paths.iter().cloned()),
1543-
AmendFastOptions::FromWorkingCopy { ref status_entries } => {
1543+
AmendFastOptions::FromWorkingCopy { status_entries } => {
15441544
for entry in status_entries {
15451545
result.extend(entry.paths().iter().cloned());
15461546
}

git-branchless-reword/src/lib.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -673,32 +673,6 @@ fn parse_bulk_edit_message(
673673
})
674674
}
675675

676-
/// Return the root commits for given a list of commits. This is the list of commits that have *no*
677-
/// ancestors also in the list. The idea is to find the minimum number of subtrees that much be
678-
/// rebased to include all of our rewording.
679-
#[instrument]
680-
fn find_subtree_roots<'repo>(
681-
repo: &'repo Repo,
682-
dag: &Dag,
683-
commits: &[Commit],
684-
) -> eyre::Result<Vec<Commit<'repo>>> {
685-
let commits: CommitSet = commits.iter().map(|commit| commit.get_oid()).collect();
686-
687-
// Find the vertices representing the roots of this set of commits
688-
let subtree_roots = dag
689-
.query_roots(commits)
690-
.wrap_err("Computing subtree roots")?;
691-
692-
// convert the vertices back into actual Commits
693-
let root_commits = dag
694-
.commit_set_to_vec(&subtree_roots)?
695-
.into_iter()
696-
.filter_map(|oid| repo.find_commit(oid).ok()?)
697-
.collect();
698-
699-
Ok(root_commits)
700-
}
701-
702676
/// Print a basic status report of what commits were reworded.
703677
#[instrument]
704678
fn render_status_report(

0 commit comments

Comments
 (0)