tree: drop Diff::as_options(), use Diff::into_options() instead

We don't have any current callers that only have a reference to a
`Diff`, so we don't need `.as_options()`.
This commit is contained in:
Martin von Zweigbergk 2023-07-06 05:18:09 -07:00 committed by Martin von Zweigbergk
parent 8af22eb83c
commit b738f884c4
2 changed files with 3 additions and 11 deletions

View file

@ -302,14 +302,6 @@ pub enum Diff<T> {
}
impl<T> Diff<T> {
pub fn as_options(&self) -> (Option<&T>, Option<&T>) {
match self {
Diff::Modified(left, right) => (Some(left), Some(right)),
Diff::Added(right) => (None, Some(right)),
Diff::Removed(left) => (Some(left), None),
}
}
pub fn into_options(self) -> (Option<T>, Option<T>) {
match self {
Diff::Modified(left, right) => (Some(left), Some(right)),

View file

@ -713,12 +713,12 @@ pub fn show_types(
) -> io::Result<()> {
formatter.with_label("diff", |formatter| {
for (repo_path, diff) in tree_diff {
let (before, after) = diff.as_options();
let (before, after) = diff.into_options();
writeln!(
formatter.labeled("modified"),
"{}{} {}",
diff_summary_char(before),
diff_summary_char(after),
diff_summary_char(before.as_ref()),
diff_summary_char(after.as_ref()),
workspace_command.format_file_path(&repo_path)
)?;
}