From 7fe85bcd1ddecf58814e35f02cab8ef652a1e9c2 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Fri, 8 Sep 2017 23:48:29 +0200 Subject: fixed some clippy warnings --- src/context.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/context.rs') diff --git a/src/context.rs b/src/context.rs index 9fb3bf4..c2e1913 100644 --- a/src/context.rs +++ b/src/context.rs @@ -34,7 +34,7 @@ impl<'i, T> Context<'i, T> { } pub fn map U>(&self, f: F) -> Context<'i, U> { - Context(self.0.iter().map(|(k, v)| (k.clone(), v.iter().map(&f).collect())).collect()) + Context(self.0.iter().map(|(k, v)| (*k, v.iter().map(&f).collect())).collect()) } } @@ -43,7 +43,7 @@ impl<'i, T: Clone> Context<'i, T> { pub fn insert(&self, k: &'i str, v: T) -> Self { let mut ctx = (*self).clone(); { - let m = ctx.0.entry(k).or_insert(vec![]); + let m = ctx.0.entry(k).or_insert_with(Vec::new); m.push(v); } ctx -- cgit v1.2.3