diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ascii.rs | 3 | ||||
| -rw-r--r-- | src/libstd/bitflags.rs | 2 | ||||
| -rw-r--r-- | src/libstd/collections/hashmap/map.rs | 32 | ||||
| -rw-r--r-- | src/libstd/dynamic_lib.rs | 3 | ||||
| -rw-r--r-- | src/libstd/io/comm_adapters.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/extensions.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/fs.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 32 | ||||
| -rw-r--r-- | src/libstd/io/net/addrinfo.rs | 5 | ||||
| -rw-r--r-- | src/libstd/io/net/ip.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/net/pipe.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/pipe.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 2 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 2 | ||||
| -rw-r--r-- | src/libstd/macros.rs | 4 | ||||
| -rw-r--r-- | src/libstd/num/f32.rs | 4 | ||||
| -rw-r--r-- | src/libstd/num/f64.rs | 2 | ||||
| -rw-r--r-- | src/libstd/num/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/num/strconv.rs | 6 | ||||
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 2 | ||||
| -rw-r--r-- | src/libstd/os.rs | 4 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 4 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 6 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rand/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rand/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync/future.rs | 2 |
28 files changed, 67 insertions, 70 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 33c8e94e32b..31f37a8a1bb 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -331,8 +331,7 @@ impl IntoStr for Vec<Ascii> { #[inline] fn into_string(self) -> String { unsafe { - let s: &str = mem::transmute(self.as_slice()); - String::from_str(s) + string::raw::from_utf8(self.into_bytes()) } } } diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index fb5934c6af6..97a1f68606f 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -258,7 +258,7 @@ macro_rules! bitflags { } #[cfg(test)] -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] mod tests { use hash; use option::{Some, None}; diff --git a/src/libstd/collections/hashmap/map.rs b/src/libstd/collections/hashmap/map.rs index 6562a644988..cb47c28f8be 100644 --- a/src/libstd/collections/hashmap/map.rs +++ b/src/libstd/collections/hashmap/map.rs @@ -14,19 +14,14 @@ use clone::Clone; use cmp::{max, Eq, Equiv, PartialEq}; use collections::{Collection, Mutable, MutableSet, Map, MutableMap}; use default::Default; -use fmt::Show; -use fmt; +use fmt::{mod, Show}; use hash::{Hash, Hasher, RandomSipHasher}; -use iter::{Iterator, FromIterator, Extendable}; -use iter; -use mem::replace; -use mem; +use iter::{mod, Iterator, FromIterator, Extendable}; +use mem::{mod, replace}; use num; -use ops::Deref; +use ops::{Deref, Index, IndexMut}; use option::{Some, None, Option}; -use result::{Ok, Err}; -use ops::Index; -use core::result::Result; +use result::{Result, Ok, Err}; use super::table; use super::table::{ @@ -837,6 +832,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// # Example /// /// ``` + /// # #![allow(deprecated)] /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); @@ -852,11 +848,9 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// *map.get_mut(&"a") = -2; /// assert_eq!(map["a"], -2); /// ``` + #[deprecated = "use indexing instead: `&mut map[key]`"] pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V { - match self.find_mut(k) { - Some(v) => v, - None => panic!("no entry found for key") - } + &mut self[*k] } /// Return true if the map contains a value for the specified key, @@ -1194,13 +1188,15 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Index<K, V> for HashMap<K, V, H> { } } -// FIXME(#12825) Indexing will always try IndexMut first and that causes issues. -/*impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> ops::IndexMut<K, V> for HashMap<K, V, H> { +impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> IndexMut<K, V> for HashMap<K, V, H> { #[inline] fn index_mut<'a>(&'a mut self, index: &K) -> &'a mut V { - self.get_mut(index) + match self.find_mut(index) { + Some(v) => v, + None => panic!("no entry found for key") + } } -}*/ +} /// HashMap iterator pub struct Entries<'a, K: 'a, V: 'a> { diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index c2f27caad1d..ec6eef07c95 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -17,7 +17,7 @@ A simple wrapper over the platform's dynamic library facilities */ #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] use clone::Clone; use collections::MutableSeq; @@ -286,6 +286,7 @@ pub mod dl { use os; use ptr; use result::{Ok, Err, Result}; + use slice::ImmutableSlice; use str::StrSlice; use str; use string::String; diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index 07f4ebda2d4..91f3f38f89d 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -15,7 +15,7 @@ use comm::{Sender, Receiver}; use io; use option::{None, Some}; use result::{Ok, Err}; -use slice::{bytes, CloneableVector}; +use slice::{bytes, CloneableVector, ImmutableSlice}; use super::{Buffer, Reader, Writer, IoResult}; use vec::Vec; diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 078a9a014c9..06ed183e936 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -10,7 +10,7 @@ //! Utility mixins that apply to all Readers and Writers -#![allow(missing_doc)] +#![allow(missing_docs)] // FIXME: Not sure how this should be structured // FIXME: Iteration should probably be considered separately diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index f749d6c823e..f193ce8cffa 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -963,7 +963,7 @@ mod test { macro_rules! error( ($e:expr, $s:expr) => ( match $e { - Ok(val) => panic!("Unexpected success. Should've been: {}", $s), + Ok(_) => panic!("Unexpected success. Should've been: {}", $s), Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()), format!("`{}` did not contain `{}`", err, $s)) } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index d22650107a3..6d6c0c0dd75 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1856,60 +1856,60 @@ bitflags! { const ALL_PERMISSIONS = USER_RWX.bits | GROUP_RWX.bits | OTHER_RWX.bits, // Deprecated names - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_READ instead"] const UserRead = USER_READ.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_WRITE instead"] const UserWrite = USER_WRITE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_EXECUTE instead"] const UserExecute = USER_EXECUTE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_READ instead"] const GroupRead = GROUP_READ.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_WRITE instead"] const GroupWrite = GROUP_WRITE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_EXECUTE instead"] const GroupExecute = GROUP_EXECUTE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_READ instead"] const OtherRead = OTHER_READ.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_WRITE instead"] const OtherWrite = OTHER_WRITE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_EXECUTE instead"] const OtherExecute = OTHER_EXECUTE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_RWX instead"] const UserRWX = USER_RWX.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_RWX instead"] const GroupRWX = GROUP_RWX.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_RWX instead"] const OtherRWX = OTHER_RWX.bits, #[doc = "Deprecated: use `USER_FILE` instead."] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_FILE instead"] const UserFile = USER_FILE.bits, #[doc = "Deprecated: use `USER_DIR` instead."] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_DIR instead"] const UserDir = USER_DIR.bits, #[doc = "Deprecated: use `USER_EXEC` instead."] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_EXEC instead"] const UserExec = USER_EXEC.bits, #[doc = "Deprecated: use `ALL_PERMISSIONS` instead"] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use ALL_PERMISSIONS instead"] const AllPermissions = ALL_PERMISSIONS.bits, } diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 9d85701eb29..3c72f58b10d 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -17,7 +17,7 @@ getaddrinfo() */ -#![allow(missing_doc)] +#![allow(missing_docs)] use iter::Iterator; use io::{IoResult, IoError}; @@ -91,7 +91,7 @@ pub fn get_host_addresses(host: &str) -> IoResult<Vec<IpAddr>> { /// /// FIXME: this is not public because the `Hint` structure is not ready for public /// consumption just yet. -#[allow(unused_variable)] +#[allow(unused_variables)] fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>) -> IoResult<Vec<Info>> { let hint = hint.map(|Hint { family, socktype, protocol, flags }| { @@ -125,6 +125,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>) // permission without help of apk #[cfg(all(test, not(target_os = "android")))] mod test { + use prelude::*; use super::*; use io::net::ip::*; diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 5140159e4ea..e93af744699 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -13,7 +13,7 @@ //! This module contains functions useful for parsing, formatting, and //! manipulating IP addresses. -#![allow(missing_doc)] +#![allow(missing_docs)] use collections::Collection; use fmt; diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs index 112094d1d39..8c7deadebea 100644 --- a/src/libstd/io/net/pipe.rs +++ b/src/libstd/io/net/pipe.rs @@ -22,7 +22,7 @@ instances as clients. */ -#![allow(missing_doc)] +#![allow(missing_docs)] use prelude::*; diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index 9362a48a6f0..c77cffd561e 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -13,7 +13,7 @@ //! Currently these aren't particularly useful, there only exists bindings //! enough so that pipes can be created to child processes. -#![allow(missing_doc)] +#![allow(missing_docs)] use prelude::*; diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 36d23590704..4e5f8822acb 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -11,7 +11,7 @@ //! Bindings for executing child processes #![allow(experimental)] -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use prelude::*; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 5451d07ab46..67080f4551f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -113,7 +113,7 @@ // Don't link to std. We are std. #![no_std] -#![deny(missing_doc)] +#![deny(missing_docs)] #![reexport_test_harness_main = "test_main"] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 9e0530a76f2..0712719dd04 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -304,11 +304,11 @@ macro_rules! println( #[macro_export] macro_rules! local_data_key( ($name:ident: $ty:ty) => ( - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static $name: ::std::local_data::Key<$ty> = &::std::local_data::KeyValueKey; ); (pub $name:ident: $ty:ty) => ( - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] pub static $name: ::std::local_data::Key<$ty> = &::std::local_data::KeyValueKey; ); ) diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 3fa181b8478..0b2f17b8f93 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -11,8 +11,8 @@ //! Operations and constants for 32-bits floats (`f32` type) #![experimental] -#![allow(missing_doc)] -#![allow(unsigned_negate)] +#![allow(missing_docs)] +#![allow(unsigned_negation)] #![doc(primitive = "f32")] use prelude::*; diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index b9d54ba182b..35555b14081 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -11,7 +11,7 @@ //! Operations and constants for 64-bits floats (`f64` type) #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] #![doc(primitive = "f64")] use prelude::*; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 564b6a25f7f..ffe162cbc64 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -14,7 +14,7 @@ //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`. #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] use option::Option; diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 6e0d81a63c9..3b17f0bc79f 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -10,7 +10,7 @@ // // ignore-lexer-test FIXME #15679 -#![allow(missing_doc)] +#![allow(missing_docs)] use char; use clone::Clone; @@ -424,10 +424,10 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+PartialEq+PartialOrd+Float+ // or set to 0 if max and carry the 1. let current_digit = ascii2value(buf[i as uint]); if current_digit < (radix - 1) { - *buf.get_mut(i as uint) = value2ascii(current_digit+1); + buf[i as uint] = value2ascii(current_digit+1); break; } else { - *buf.get_mut(i as uint) = value2ascii(0); + buf[i as uint] = value2ascii(0); i -= 1; } } diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index f9bc9eb539a..c69c3ffa41c 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -11,7 +11,7 @@ #![experimental] #![macro_escape] #![doc(hidden)] -#![allow(unsigned_negate)] +#![allow(unsigned_negation)] macro_rules! uint_module (($T:ty) => ( diff --git a/src/libstd/os.rs b/src/libstd/os.rs index c7994ae84e8..d4e6251cebe 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -28,7 +28,7 @@ #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] #![allow(non_snake_case)] use clone::Clone; @@ -144,7 +144,7 @@ pub mod windows { use option::{None, Option}; use option; use os::TMPBUF_SZ; - use slice::MutableSlice; + use slice::{MutableSlice, ImmutableSlice}; use string::String; use str::StrSlice; use vec::Vec; diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index f27a1c1feda..0d7a467b313 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -457,9 +457,9 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option<Vec<&'a [u8]>> { } } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static dot_static: &'static [u8] = b"."; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static dot_dot_static: &'static [u8] = b".."; #[cfg(test)] diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 1897c8638cc..1ddc027a07e 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -776,7 +776,7 @@ impl Path { let mut s = String::from_str(s.slice_to(len)); unsafe { let v = s.as_mut_vec(); - *v.get_mut(0) = (*v)[0] + v[0] = (*v)[0] .to_ascii() .to_uppercase() .to_byte(); @@ -784,7 +784,7 @@ impl Path { if is_abs { // normalize C:/ to C:\ unsafe { - *s.as_mut_vec().get_mut(2) = SEP_BYTE; + s.as_mut_vec()[2] = SEP_BYTE; } } Some(s) @@ -794,7 +794,7 @@ impl Path { let mut s = String::from_str(s.slice_to(len)); unsafe { let v = s.as_mut_vec(); - *v.get_mut(4) = (*v)[4].to_ascii().to_uppercase().to_byte(); + v[4] = (*v)[4].to_ascii().to_uppercase().to_byte(); } Some(s) } diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index db9f3114cda..48be404b0d0 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -76,7 +76,7 @@ #[doc(no_inline)] pub use num::{FloatMath, ToPrimitive, FromPrimitive}; #[doc(no_inline)] pub use boxed::Box; #[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath}; -#[doc(no_inline)] pub use ptr::RawPtr; +#[doc(no_inline)] pub use ptr::{RawPtr, RawMutPtr}; #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek}; #[doc(no_inline)] pub use str::{Str, StrVector, StrSlice}; #[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrSlice}; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index d1c655cb4d0..21e531d211a 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -411,7 +411,7 @@ pub fn sample<T, I: Iterator<T>, R: Rng>(rng: &mut R, for (i, elem) in iter.enumerate() { let k = rng.gen_range(0, i + 1 + amount); if k < amount { - *reservoir.get_mut(k) = elem; + reservoir[k] = elem; } } return reservoir; diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 424fd039fd4..bf5bdc8a308 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -88,7 +88,7 @@ mod imp { #[repr(C)] struct SecRandom; - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static kSecRandomDefault: *const SecRandom = 0 as *const SecRandom; #[link(name = "Security", kind = "framework")] diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index e36d4ce8d4b..b97e80d0dc1 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -52,7 +52,7 @@ Several modules in `core` are clients of `rt`: #![experimental] // FIXME: this should not be here. -#![allow(missing_doc)] +#![allow(missing_docs)] use failure; use rustrt; diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 36070509432..be0af3a3f1a 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -24,7 +24,7 @@ * ``` */ -#![allow(missing_doc)] +#![allow(missing_docs)] use core::prelude::*; use core::mem::replace; |
