From 035fb94cd2a1e75c4674240df644c86cd99d25c5 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 10 Jun 2015 08:59:47 +1000 Subject: [PATCH] Rename 'nightly' feature to 'unstable'. --- .travis.yml | 5 ++++- Cargo.toml | 2 +- README.md | 2 +- src/any.rs | 4 ++-- src/lib.rs | 2 +- src/raw.rs | 32 ++++++++++++++++---------------- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b7902c..ba08163 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,12 @@ language: rust +rust: + - nightly + - beta env: global: - secure: nR+DJRUQ9v03nNZMpMu1tGKLKBAqdQsTIAr8ffdl+DUEh3b2jvQ+vLLNFLPjsloqhoOXo7cWO7qVpiE4ZOq2lNDURQjdiZGFjh/Y5+xKy2BqFdV7qQ1JoBzsMyx28tQTYz0mtBsACiCYKKb+ddNX5hpwrsjp8cS7htZktA5kbiU= script: - - if [[ "$(rustc --version)" =~ -(dev|nightly) ]]; then cargo test --features nightly; else ! cargo test --features nightly; fi + - if [[ "$(rustc --version)" =~ -(dev|nightly) ]]; then cargo test --features unstable; else ! cargo test --features unstable; fi - cargo test - cargo doc after_script: diff --git a/Cargo.toml b/Cargo.toml index 2cd1601..747cba5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ keywords = ["container", "data-structure", "map"] license = "MIT/Apache-2.0" [features] -nightly = [] +unstable = [] diff --git a/README.md b/README.md index 77b147b..e1c65ac 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Instructions Cargo all the way: it is `anymap` on crates.io. -For users of the nightly instead of the beta of rustc there are a couple of things behind the `nightly` feature like a `drain` method on the `RawAnyMap` and a more efficient hashing technique which makes lookup in the map a tad faster. +For users of the nightly instead of the beta of rustc there are a couple of things behind the `unstable` feature like a `drain` method on the `RawAnyMap` and a more efficient hashing technique which makes lookup in the map a tad faster. Author ------ diff --git a/src/any.rs b/src/any.rs index 5b5e6e6..93130e0 100644 --- a/src/any.rs +++ b/src/any.rs @@ -88,10 +88,10 @@ macro_rules! impl_clone { } } -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] use std::raw::TraitObject; -#[cfg(not(feature = "nightly"))] +#[cfg(not(feature = "unstable"))] #[repr(C)] #[allow(raw_pointer_derive)] #[derive(Copy, Clone)] diff --git a/src/lib.rs b/src/lib.rs index 4bc330f..b5ae44a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ //! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type. -#![cfg_attr(feature = "nightly", feature(core, std_misc))] +#![cfg_attr(feature = "unstable", feature(core, std_misc))] #![cfg_attr(test, feature(test))] #![warn(missing_docs, unused_results)] diff --git a/src/raw.rs b/src/raw.rs index 6439771..efa4852 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -5,31 +5,31 @@ use std::any::TypeId; use std::borrow::Borrow; use std::collections::hash_map::{self, HashMap}; -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] use std::collections::hash_state::HashState; use std::default::Default; use std::hash::Hash; -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] use std::hash::Hasher; use std::iter::IntoIterator; -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] use std::mem; use std::ops::{Index, IndexMut}; -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] use std::ptr; use any::{Any, UncheckedAnyExt}; -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] struct TypeIdHasher { value: u64, } #[derive(Clone)] -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] struct TypeIdState; -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] impl HashState for TypeIdState { type Hasher = TypeIdHasher; @@ -38,7 +38,7 @@ impl HashState for TypeIdState { } } -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] impl Hasher for TypeIdHasher { #[inline(always)] fn write(&mut self, bytes: &[u8]) { @@ -63,10 +63,10 @@ impl Hasher for TypeIdHasher { /// doesn’t tend to be so very useful. Still, if you need it, it’s here. #[derive(Debug)] pub struct RawMap { - #[cfg(feature = "nightly")] + #[cfg(feature = "unstable")] inner: HashMap, TypeIdState>, - #[cfg(not(feature = "nightly"))] + #[cfg(not(feature = "unstable"))] inner: HashMap>, } @@ -85,14 +85,14 @@ impl Default for RawMap { } } -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] impl_common_methods! { field: RawMap.inner; new() => HashMap::with_hash_state(TypeIdState); with_capacity(capacity) => HashMap::with_capacity_and_hash_state(capacity, TypeIdState); } -#[cfg(not(feature = "nightly"))] +#[cfg(not(feature = "unstable"))] impl_common_methods! { field: RawMap.inner; new() => HashMap::new(); @@ -140,17 +140,17 @@ impl ExactSizeIterator for IntoIter { } /// RawMap drain iterator. -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] pub struct Drain<'a, A: ?Sized + UncheckedAnyExt> { inner: hash_map::Drain<'a, TypeId, Box>, } -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] impl<'a, A: ?Sized + UncheckedAnyExt> Iterator for Drain<'a, A> { type Item = Box; #[inline] fn next(&mut self) -> Option> { self.inner.next().map(|x| x.1) } #[inline] fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } } -#[cfg(feature = "nightly")] +#[cfg(feature = "unstable")] impl<'a, A: ?Sized + UncheckedAnyExt> ExactSizeIterator for Drain<'a, A> { #[inline] fn len(&self) -> usize { self.inner.len() } } @@ -182,7 +182,7 @@ impl RawMap { /// /// Keeps the allocated memory for reuse. #[inline] - #[cfg(feature = "nightly")] + #[cfg(feature = "unstable")] pub fn drain(&mut self) -> Drain { Drain { inner: self.inner.drain(), -- 2.42.0