auto merge of #8988 : cmr/rust/fromstr_fn, r=brson

It just calls out to the associated function on the trait.
This commit is contained in:
bors 2013-09-08 12:05:55 -07:00
commit dd5c7379e9
5 changed files with 9 additions and 3 deletions

View File

@ -19,3 +19,8 @@ pub trait FromStr {
/// string is ill-formatted, the None is returned.
fn from_str(s: &str) -> Option<Self>;
}
/// A utility function that just calls FromStr::from_str
pub fn from_str<A: FromStr>(s: &str) -> Option<A> {
FromStr::from_str(s)
}

View File

@ -946,8 +946,8 @@ impl Float for float {
#[cfg(test)]
mod tests {
use super::*;
use prelude::*;
use super::*;
use num::*;
use num;

View File

@ -547,8 +547,8 @@ impl ToStrRadix for $T {
#[cfg(test)]
mod tests {
use super::*;
use prelude::*;
use super::*;
use int;
use i16;

View File

@ -430,8 +430,8 @@ impl BitCount for $T {
#[cfg(test)]
mod tests {
use super::*;
use prelude::*;
use super::*;
use num;
use sys;

View File

@ -41,6 +41,7 @@ pub use result::{Result, Ok, Err};
// Reexported functions
pub use io::{print, println};
pub use iterator::range;
pub use from_str::from_str;
// Reexported types and traits
pub use c_str::ToCStr;