From 3cd244b9fa825a6778f40b719aa863eb576bf283 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 1 Nov 2018 13:45:10 +0100 Subject: [PATCH] static_map: remove starnge type borrow --- src/static_map.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/static_map.rs b/src/static_map.rs index 06bcb2981..c26435602 100644 --- a/src/static_map.rs +++ b/src/static_map.rs @@ -1,25 +1,19 @@ -use std::borrow::Borrow; - #[derive(Debug)] pub struct StaticMap<'a, K, V> { pub entries: &'a [(K,V)], } -impl<'a, K, V> StaticMap<'a, K, V> - where K: Eq { +impl<'a, K: Eq, V> StaticMap<'a, K, V> { #[inline] pub fn len(&self) -> usize { self.entries.len() } - pub fn get(&self, key: &Q) -> Option<&V> - where K: Borrow + std::cmp::PartialEq, - Q: Eq { + pub fn get(&self, key: &K) -> Option<&V> { for (ref k, ref v) in self.entries { if k == key { return Some(v) } } - None } }