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:
commit
dd5c7379e9
@ -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)
|
||||
}
|
||||
|
@ -946,8 +946,8 @@ impl Float for float {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
|
||||
use num::*;
|
||||
use num;
|
||||
|
@ -547,8 +547,8 @@ impl ToStrRadix for $T {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
|
||||
use int;
|
||||
use i16;
|
||||
|
@ -430,8 +430,8 @@ impl BitCount for $T {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
|
||||
use num;
|
||||
use sys;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user