Skip to content

Commit 8c9dd54

Browse files
author
David Rajchenbach-Teller
committed
[Renaming] str_to_float is now float::from_str, float_to_str is now float::to_str
1 parent 7faed3d commit 8c9dd54

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/comp/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn time<@T>(do_it: bool, what: str, thunk: fn() -> T) -> T {
9494
let rv = thunk();
9595
let end = std::time::precise_time_s();
9696
log_err #fmt["time: %s took %s s", what,
97-
std::float::float_to_str(end - start, 3u)];
97+
std::float::to_str(end - start, 3u)];
9898
ret rv;
9999
}
100100

src/comp/middle/typeck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,8 +1303,8 @@ fn valid_range_bounds(l1: @ast::lit, l2: @ast::lit) -> bool {
13031303
alt l1.node {
13041304
ast::lit_float(s1) | ast::lit_mach_float(_, s1) {
13051305
let s2 = lit_as_float(l2);
1306-
let f1 = std::float::str_to_float(s1);
1307-
let f2 = std::float::str_to_float(s2);
1306+
let f1 = std::float::from_str(s1);
1307+
let f2 = std::float::from_str(s2);
13081308
ret *util::common::min(f1, f2) == f1
13091309
}
13101310
ast::lit_uint(_) | ast::lit_char(_) {

src/comp/util/common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ fn lit_in_range(l: @ast::lit, m1: @ast::lit, m2: @ast::lit) -> bool {
156156
frange(f1, f2) {
157157
alt l.node {
158158
ast::lit_float(f3) | ast::lit_mach_float(_, f3) {
159-
std::float::str_to_float(f3) >= *min(f1, f2) &&
160-
std::float::str_to_float(f3) <= *max(f1, f2)
159+
std::float::from_str(f3) >= *min(f1, f2) &&
160+
std::float::from_str(f3) <= *max(f1, f2)
161161
}
162162
_ { fail }
163163
}
@@ -232,7 +232,7 @@ fn lits_to_range(l: @ast::lit, r: @ast::lit) -> range {
232232
}
233233
ast::lit_float(f1) | ast::lit_mach_float(_, f1) {
234234
alt r.node { ast::lit_float(f2) | ast::lit_mach_float(_, f2) {
235-
frange(std::float::str_to_float(f1), std::float::str_to_float(f2))
235+
frange(std::float::from_str(f1), std::float::from_str(f2))
236236
}
237237
_ { fail } }
238238
}

src/lib/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* String conversions
33
*/
44

5-
fn float_to_str(num: float, digits: uint) -> str {
5+
fn to_str(num: float, digits: uint) -> str {
66
let accum = if num < 0.0 { num = -num; "-" } else { "" };
77
let trunc = num as uint;
88
let frac = num - (trunc as float);
@@ -36,7 +36,7 @@ fn float_to_str(num: float, digits: uint) -> str {
3636
* @return [NaN] if the string did not represent a valid number.
3737
* @return Otherwise, the floating-point number represented [num].
3838
*/
39-
fn str_to_float(num: str) -> float {
39+
fn from_str(num: str) -> float {
4040
let pos = 0u; //Current byte position in the string.
4141
//Used to walk the string in O(n).
4242
let len = str::byte_len(num); //Length of the string, in bytes.

0 commit comments

Comments
 (0)