Skip to content

Commit 7225369

Browse files
committed
Save an allocation
1 parent 1f8995e commit 7225369

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/commands/release.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl Release {
273273
let Some(mut readme) = readme_file.get()? else {
274274
bail!("README.md suddenly disappeared!");
275275
};
276-
if readme.ensure_changelog_link(&ghrepo, &default_branch) {
276+
if readme.ensure_changelog_link(&ghrepo, default_branch) {
277277
log::info!("Adding Changelog link to README.md ...");
278278
readme_file.set(readme)?;
279279
}

src/git.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ impl<'a> Git<'a> {
138138
}
139139

140140
// Returns None if the default branch could not be determined
141-
pub(crate) fn default_branch(&self) -> Result<Option<String>, CommandOutputError> {
141+
pub(crate) fn default_branch(&self) -> Result<Option<&'static str>, CommandOutputError> {
142142
let branches = self
143143
.readlines("branch", ["--format=%(refname:short)"])?
144144
.collect::<HashSet<_>>();
145145
for guess in ["main", "master"] {
146146
if branches.contains(guess) {
147-
return Ok(Some(guess.to_owned()));
147+
return Ok(Some(guess));
148148
}
149149
}
150150
Ok(None)

0 commit comments

Comments
 (0)