From 92122e2d642f3610925679f8f1e6c3d259a7db09 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 20 Aug 2019 19:33:45 +0200 Subject: [PATCH] Move use of 'default fn' to its own module. --- lib.rs | 7 +------ specialization.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 specialization.rs diff --git a/lib.rs b/lib.rs index c973eb0..cedf2bd 100644 --- a/lib.rs +++ b/lib.rs @@ -1253,12 +1253,7 @@ trait SpecFrom { } #[cfg(feature = "specialization")] -impl<'a, A: Array> SpecFrom for SmallVec where A::Item: Clone { - #[inline] - default fn spec_from(slice: &'a [A::Item]) -> SmallVec { - slice.into_iter().cloned().collect() - } -} +mod specialization; #[cfg(feature = "specialization")] impl<'a, A: Array> SpecFrom for SmallVec where A::Item: Copy { diff --git a/specialization.rs b/specialization.rs new file mode 100644 index 0000000..2e7bb1e --- /dev/null +++ b/specialization.rs @@ -0,0 +1,16 @@ +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementations that require `default fn`. + +use super::{SpecFrom, SmallVec, Array}; + +impl<'a, A: Array> SpecFrom for SmallVec where A::Item: Clone { + #[inline] + default fn spec_from(slice: &'a [A::Item]) -> SmallVec { + slice.into_iter().cloned().collect() + } +}