Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove unnecessary lifetimes from `tab_description`
Joseph Lyons304eddbbe4a8
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rsindex 64147effff0..c5e0e8993e4 100644--- a/crates/editor/src/items.rs+++ b/crates/editor/src/items.rs@@ -531,7 +531,7 @@ impl Item for Editor {Some(file_path.into())}- fn tab_description<'a>(&'a self, detail: usize, cx: &'a AppContext) -> Option<Cow<'a, str>> {+ fn tab_description<'a>(&'a self, detail: usize, cx: &'a AppContext) -> Option<Cow<str>> {match path_for_buffer(&self.buffer, detail, true, cx)? {Cow::Borrowed(path) => Some(path.to_string_lossy()),Cow::Owned(path) => Some(path.to_string_lossy().to_string().into()),diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rsindex 4cf47c77132..6c41507478a 100644--- a/crates/workspace/src/item.rs+++ b/crates/workspace/src/item.rs@@ -47,7 +47,7 @@ pub trait Item: View {fn tab_tooltip_text(&self, _: &AppContext) -> Option<Cow<str>> {None}- fn tab_description<'a>(&'a self, _: usize, _: &'a AppContext) -> Option<Cow<'a, str>> {+ fn tab_description<'a>(&'a self, _: usize, _: &'a AppContext) -> Option<Cow<str>> {None}fn tab_content(&self, detail: Option<usize>, style: &theme::Tab, cx: &AppContext)@@ -165,8 +165,8 @@ pub trait ItemHandle: 'static + fmt::Debug {cx: &mut AppContext,handler: Box<dyn Fn(ItemEvent, &mut AppContext)>,) -> gpui::Subscription;- fn tab_tooltip_text<'a>(&'a self, cx: &'a AppContext) -> Option<Cow<str>>;- fn tab_description<'a>(&self, detail: usize, cx: &'a AppContext) -> Option<Cow<'a, str>>;+ fn tab_tooltip_text<'a>(&self, cx: &'a AppContext) -> Option<Cow<'a, str>>;+ fn tab_description<'a>(&'a self, detail: usize, cx: &'a AppContext) -> Option<Cow<'a, str>>;fn tab_content(&self, detail: Option<usize>, style: &theme::Tab, cx: &AppContext)-> ElementBox;fn project_path(&self, cx: &AppContext) -> Option<ProjectPath>;@@ -252,11 +252,11 @@ impl<T: Item> ItemHandle for ViewHandle<T> {})}- fn tab_tooltip_text<'a>(&'a self, cx: &'a AppContext) -> Option<Cow<str>> {+ fn tab_tooltip_text<'a>(&self, cx: &'a AppContext) -> Option<Cow<'a, str>> {self.read(cx).tab_tooltip_text(cx)}- fn tab_description<'a>(&self, detail: usize, cx: &'a AppContext) -> Option<Cow<'a, str>> {+ fn tab_description<'a>(&'a self, detail: usize, cx: &'a AppContext) -> Option<Cow<'a, str>> {self.read(cx).tab_description(detail, cx)}@@ -913,7 +913,7 @@ pub(crate) mod test {}impl Item for TestItem {- fn tab_description<'a>(&'a self, detail: usize, _: &'a AppContext) -> Option<Cow<'a, str>> {+ fn tab_description(&self, detail: usize, _: &AppContext) -> Option<Cow<str>> {self.tab_descriptions.as_ref().and_then(|descriptions| {let description = *descriptions.get(detail).or_else(|| descriptions.last())?;Some(description.into())