History

[commitgraph] Loosen lifetime restrictions on return values.

Conor Davis committed 6 years ago

Commit 701f33c1 parent 28f94b41 file · +12 −2Browse files

Showing the changes to git-commitgraph/src (1 of 1 file). Show all

Unified · Split

git-commitgraph/src/file/commit.rs+12−2
@@ -77,7 +77,12 @@ impl<'a> Commit<'a> { · 76 unmodified lines
77 }77 }
78 }78 }
79 79
80 pub fn id(&self) -> borrowed::Id<'_> {80 // Allow the return value to outlive this Commit object, as it only needs to be bound by the
81 // lifetime of the parent file.
82 pub fn id<'b>(&'b self) -> borrowed::Id<'a>
83 where
84 'a: 'b,
85 {
81 self.file.id_at(self.pos)86 self.file.id_at(self.pos)
82 }87 }
83 88
@@ -85,7 +90,12 @@ impl<'a> Commit<'a> { · 1 unmodified line
85 self.iter_parents().next().transpose()90 self.iter_parents().next().transpose()
86 }91 }
87 92
88 pub fn root_tree_id(&self) -> borrowed::Id<'_> {93 // Allow the return value to outlive this Commit object, as it only needs to be bound by the
94 // lifetime of the parent file.
95 pub fn root_tree_id<'b>(&'b self) -> borrowed::Id<'a>
96 where
97 'a: 'b,
98 {
89 self.root_tree_id99 self.root_tree_id
90 }100 }
91}101}