From 12322c9fae28150bc7962a14286ce0a1e8f2c664 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 17 Dec 2023 18:24:10 +0100 Subject: [PATCH] fix(ds): be consistent about required traits Signed-off-by: Matej Focko --- src/data_structures/min_heap.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/data_structures/min_heap.rs b/src/data_structures/min_heap.rs index 9dfe509..323ff2e 100644 --- a/src/data_structures/min_heap.rs +++ b/src/data_structures/min_heap.rs @@ -5,8 +5,11 @@ pub struct MinHeap { heap: BinaryHeap>, } -impl MinHeap { - pub fn new() -> MinHeap { +impl MinHeap +where + T: Ord, +{ + pub fn new() -> Self { MinHeap { heap: BinaryHeap::new(), } @@ -21,7 +24,10 @@ impl MinHeap { } } -impl Default for MinHeap { +impl Default for MinHeap +where + T: Ord, +{ fn default() -> Self { Self::new() }