Skip to content

Commit 4634f7e

Browse files
committed
librustc: Remove all uses of static from functions. rs=destatic
1 parent 1616ffd commit 4634f7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+281
-286
lines changed

src/libcore/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub pure fn is_false(v: bool) -> bool { !v }
4949

5050
/// Parse logic value from `s`
5151
impl FromStr for bool {
52-
static pure fn from_str(s: &str) -> Option<bool> {
52+
pure fn from_str(s: &str) -> Option<bool> {
5353
if s == "true" {
5454
Some(true)
5555
} else if s == "false" {

src/libcore/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn concat<T>(lists: @mut DList<@mut DList<T>>) -> @mut DList<T> {
126126
}
127127
128128
priv impl<T> DList<T> {
129-
static pure fn new_link(data: T) -> DListLink<T> {
129+
pure fn new_link(data: T) -> DListLink<T> {
130130
Some(@mut DListNode {
131131
data: data,
132132
linked: true,

src/libcore/from_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
use option::Option;
1414

1515
pub trait FromStr {
16-
static pure fn from_str(s: &str) -> Option<Self>;
16+
pure fn from_str(s: &str) -> Option<Self>;
1717
}

src/libcore/hashmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub mod linear {
373373
374374
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
375375
/// Create an empty LinearMap
376-
static fn new() -> LinearMap<K, V> {
376+
fn new() -> LinearMap<K, V> {
377377
linear_map_with_capacity(INITIAL_CAPACITY)
378378
}
379379
@@ -639,7 +639,7 @@ pub mod linear {
639639

640640
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
641641
/// Create an empty LinearSet
642-
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
642+
fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
643643

644644
/// Reserve space for at least `n` elements in the hash table.
645645
fn reserve_at_least(&mut self, n: uint) {

src/libcore/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ pub trait Buildable<A> {
8989
* as an argument a function that will push an element
9090
* onto the sequence being constructed.
9191
*/
92-
static pure fn build_sized(size: uint,
93-
builder: &fn(push: &pure fn(A))) -> Self;
92+
pure fn build_sized(size: uint,
93+
builder: &fn(push: &pure fn(A))) -> Self;
9494
}
9595

9696
#[inline(always)]

src/libcore/num/f32.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,20 +277,20 @@ impl cmp::Ord for f32 {
277277

278278
impl num::Zero for f32 {
279279
#[inline(always)]
280-
static pure fn zero() -> f32 { 0.0 }
280+
pure fn zero() -> f32 { 0.0 }
281281
}
282282

283283
impl num::One for f32 {
284284
#[inline(always)]
285-
static pure fn one() -> f32 { 1.0 }
285+
pure fn one() -> f32 { 1.0 }
286286
}
287287

288288
impl NumCast for f32 {
289289
/**
290290
* Cast `n` to an `f32`
291291
*/
292292
#[inline(always)]
293-
static pure fn from<N:NumCast>(n: N) -> f32 { n.to_f32() }
293+
pure fn from<N:NumCast>(n: N) -> f32 { n.to_f32() }
294294

295295
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
296296
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }
@@ -568,12 +568,12 @@ pub pure fn from_str_radix(num: &str, rdx: uint) -> Option<f32> {
568568

569569
impl from_str::FromStr for f32 {
570570
#[inline(always)]
571-
static pure fn from_str(val: &str) -> Option<f32> { from_str(val) }
571+
pure fn from_str(val: &str) -> Option<f32> { from_str(val) }
572572
}
573573

574574
impl num::FromStrRadix for f32 {
575575
#[inline(always)]
576-
static pure fn from_str_radix(val: &str, rdx: uint) -> Option<f32> {
576+
pure fn from_str_radix(val: &str, rdx: uint) -> Option<f32> {
577577
from_str_radix(val, rdx)
578578
}
579579
}

src/libcore/num/f64.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl NumCast for f64 {
304304
* Cast `n` to an `f64`
305305
*/
306306
#[inline(always)]
307-
static pure fn from<N:NumCast>(n: N) -> f64 { n.to_f64() }
307+
pure fn from<N:NumCast>(n: N) -> f64 { n.to_f64() }
308308

309309
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
310310
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }
@@ -325,12 +325,12 @@ impl NumCast for f64 {
325325

326326
impl num::Zero for f64 {
327327
#[inline(always)]
328-
static pure fn zero() -> f64 { 0.0 }
328+
pure fn zero() -> f64 { 0.0 }
329329
}
330330

331331
impl num::One for f64 {
332332
#[inline(always)]
333-
static pure fn one() -> f64 { 1.0 }
333+
pure fn one() -> f64 { 1.0 }
334334
}
335335

336336
#[cfg(notest)]
@@ -592,12 +592,12 @@ pub pure fn from_str_radix(num: &str, rdx: uint) -> Option<f64> {
592592

593593
impl from_str::FromStr for f64 {
594594
#[inline(always)]
595-
static pure fn from_str(val: &str) -> Option<f64> { from_str(val) }
595+
pure fn from_str(val: &str) -> Option<f64> { from_str(val) }
596596
}
597597

598598
impl num::FromStrRadix for f64 {
599599
#[inline(always)]
600-
static pure fn from_str_radix(val: &str, rdx: uint) -> Option<f64> {
600+
pure fn from_str_radix(val: &str, rdx: uint) -> Option<f64> {
601601
from_str_radix(val, rdx)
602602
}
603603
}

src/libcore/num/float.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ pub pure fn from_str_radix(num: &str, radix: uint) -> Option<float> {
304304
305305
impl from_str::FromStr for float {
306306
#[inline(always)]
307-
static pure fn from_str(val: &str) -> Option<float> { from_str(val) }
307+
pure fn from_str(val: &str) -> Option<float> { from_str(val) }
308308
}
309309
310310
impl num::FromStrRadix for float {
311311
#[inline(always)]
312-
static pure fn from_str_radix(val: &str, radix: uint) -> Option<float> {
312+
pure fn from_str_radix(val: &str, radix: uint) -> Option<float> {
313313
from_str_radix(val, radix)
314314
}
315315
}
@@ -408,20 +408,20 @@ impl Ord for float {
408408
409409
impl num::Zero for float {
410410
#[inline(always)]
411-
static pure fn zero() -> float { 0.0 }
411+
pure fn zero() -> float { 0.0 }
412412
}
413413
414414
impl num::One for float {
415415
#[inline(always)]
416-
static pure fn one() -> float { 1.0 }
416+
pure fn one() -> float { 1.0 }
417417
}
418418
419419
impl NumCast for float {
420420
/**
421421
* Cast `n` to a `float`
422422
*/
423423
#[inline(always)]
424-
static pure fn from<N:NumCast>(n: N) -> float { n.to_float() }
424+
pure fn from<N:NumCast>(n: N) -> float { n.to_float() }
425425
426426
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
427427
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/int-template.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ impl Eq for T {
163163
164164
impl num::Zero for T {
165165
#[inline(always)]
166-
static pure fn zero() -> T { 0 }
166+
pure fn zero() -> T { 0 }
167167
}
168168
169169
impl num::One for T {
170170
#[inline(always)]
171-
static pure fn one() -> T { 1 }
171+
pure fn one() -> T { 1 }
172172
}
173173
174174
#[cfg(notest)]
@@ -221,14 +221,14 @@ pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
221221
222222
impl FromStr for T {
223223
#[inline(always)]
224-
static pure fn from_str(s: &str) -> Option<T> {
224+
pure fn from_str(s: &str) -> Option<T> {
225225
from_str(s)
226226
}
227227
}
228228
229229
impl FromStrRadix for T {
230230
#[inline(always)]
231-
static pure fn from_str_radix(&self, s: &str, radix: uint) -> Option<T> {
231+
pure fn from_str_radix(s: &str, radix: uint) -> Option<T> {
232232
from_str_radix(s, radix)
233233
}
234234
}

src/libcore/num/int-template/i16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl NumCast for i16 {
2222
* Cast `n` to a `i16`
2323
*/
2424
#[inline(always)]
25-
static pure fn from<N:NumCast>(n: N) -> i16 { n.to_i16() }
25+
pure fn from<N:NumCast>(n: N) -> i16 { n.to_i16() }
2626

2727
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
2828
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/int-template/i32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl NumCast for i32 {
2222
* Cast `n` to a `i32`
2323
*/
2424
#[inline(always)]
25-
static pure fn from<N:NumCast>(n: N) -> i32 { n.to_i32() }
25+
pure fn from<N:NumCast>(n: N) -> i32 { n.to_i32() }
2626

2727
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
2828
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/int-template/i64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl NumCast for i64 {
2222
* Cast `n` to a `i64`
2323
*/
2424
#[inline(always)]
25-
static pure fn from<N:NumCast>(n: N) -> i64 { n.to_i64() }
25+
pure fn from<N:NumCast>(n: N) -> i64 { n.to_i64() }
2626

2727
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
2828
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/int-template/i8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl NumCast for i8 {
2222
* Cast `n` to a `i8`
2323
*/
2424
#[inline(always)]
25-
static pure fn from<N:NumCast>(n: N) -> i8 { n.to_i8() }
25+
pure fn from<N:NumCast>(n: N) -> i8 { n.to_i8() }
2626

2727
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
2828
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/int-template/int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl NumCast for int {
6363
* Cast `n` to a `int`
6464
*/
6565
#[inline(always)]
66-
static pure fn from<N:NumCast>(n: N) -> int { n.to_int() }
66+
pure fn from<N:NumCast>(n: N) -> int { n.to_int() }
6767

6868
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
6969
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/num.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ pub mod strconv;
1818

1919
pub trait IntConvertible {
2020
pure fn to_int(&self) -> int;
21-
static pure fn from_int(n: int) -> Self;
21+
pure fn from_int(n: int) -> Self;
2222
}
2323

2424
pub trait Zero {
25-
static pure fn zero() -> Self;
25+
pure fn zero() -> Self;
2626
}
2727

2828
pub trait One {
29-
static pure fn one() -> Self;
29+
pure fn one() -> Self;
3030
}
3131

3232
pub pure fn abs<T:Ord + Zero + Neg<T>>(v: T) -> T {
@@ -67,7 +67,7 @@ pub pure fn cast<T:NumCast,U:NumCast>(n: T) -> U {
6767
* An interface for generic numeric type casts
6868
*/
6969
pub trait NumCast {
70-
static pure fn from<T:NumCast>(n: T) -> Self;
70+
pure fn from<T:NumCast>(n: T) -> Self;
7171

7272
pure fn to_u8(&self) -> u8;
7373
pure fn to_u16(&self) -> u16;
@@ -91,7 +91,7 @@ pub trait ToStrRadix {
9191
}
9292

9393
pub trait FromStrRadix {
94-
static pub pure fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
94+
pub pure fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
9595
}
9696

9797
// Generic math functions:

src/libcore/num/strconv.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ pure fn is_neg_zero<T:Eq+One+Zero+NumStrConv+Div<T,T>>(num: &T) -> bool {
6666
}
6767

6868
pub trait NumStrConv {
69-
static pure fn NaN() -> Option<Self>;
70-
static pure fn inf() -> Option<Self>;
71-
static pure fn neg_inf() -> Option<Self>;
72-
static pure fn neg_zero() -> Option<Self>;
69+
pure fn NaN() -> Option<Self>;
70+
pure fn inf() -> Option<Self>;
71+
pure fn neg_inf() -> Option<Self>;
72+
pure fn neg_zero() -> Option<Self>;
7373

7474
pure fn round_to_zero(&self) -> Self;
7575
pure fn fractional_part(&self) -> Self;
@@ -78,13 +78,13 @@ pub trait NumStrConv {
7878
macro_rules! impl_NumStrConv_Floating (($t:ty) => (
7979
impl NumStrConv for $t {
8080
#[inline(always)]
81-
static pure fn NaN() -> Option<$t> { Some( 0.0 / 0.0) }
81+
pure fn NaN() -> Option<$t> { Some( 0.0 / 0.0) }
8282
#[inline(always)]
83-
static pure fn inf() -> Option<$t> { Some( 1.0 / 0.0) }
83+
pure fn inf() -> Option<$t> { Some( 1.0 / 0.0) }
8484
#[inline(always)]
85-
static pure fn neg_inf() -> Option<$t> { Some(-1.0 / 0.0) }
85+
pure fn neg_inf() -> Option<$t> { Some(-1.0 / 0.0) }
8686
#[inline(always)]
87-
static pure fn neg_zero() -> Option<$t> { Some(-0.0 ) }
87+
pure fn neg_zero() -> Option<$t> { Some(-0.0 ) }
8888

8989
#[inline(always)]
9090
pure fn round_to_zero(&self) -> $t {
@@ -102,10 +102,10 @@ macro_rules! impl_NumStrConv_Floating (($t:ty) => (
102102

103103
macro_rules! impl_NumStrConv_Integer (($t:ty) => (
104104
impl NumStrConv for $t {
105-
#[inline(always)] static pure fn NaN() -> Option<$t> { None }
106-
#[inline(always)] static pure fn inf() -> Option<$t> { None }
107-
#[inline(always)] static pure fn neg_inf() -> Option<$t> { None }
108-
#[inline(always)] static pure fn neg_zero() -> Option<$t> { None }
105+
#[inline(always)] pure fn NaN() -> Option<$t> { None }
106+
#[inline(always)] pure fn inf() -> Option<$t> { None }
107+
#[inline(always)] pure fn neg_inf() -> Option<$t> { None }
108+
#[inline(always)] pure fn neg_zero() -> Option<$t> { None }
109109

110110
#[inline(always)] pure fn round_to_zero(&self) -> $t { *self }
111111
#[inline(always)] pure fn fractional_part(&self) -> $t { 0 }

src/libcore/num/uint-template.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ impl Eq for T {
129129
130130
impl num::Zero for T {
131131
#[inline(always)]
132-
static pure fn zero() -> T { 0 }
132+
pure fn zero() -> T { 0 }
133133
}
134134
135135
impl num::One for T {
136136
#[inline(always)]
137-
static pure fn one() -> T { 1 }
137+
pure fn one() -> T { 1 }
138138
}
139139
140140
#[cfg(notest)]
@@ -187,14 +187,14 @@ pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
187187
188188
impl FromStr for T {
189189
#[inline(always)]
190-
static pure fn from_str(s: &str) -> Option<T> {
190+
pure fn from_str(s: &str) -> Option<T> {
191191
from_str(s)
192192
}
193193
}
194194
195195
impl FromStrRadix for T {
196196
#[inline(always)]
197-
static pure fn from_str_radix(&self, s: &str, radix: uint) -> Option<T> {
197+
pure fn from_str_radix(s: &str, radix: uint) -> Option<T> {
198198
from_str_radix(s, radix)
199199
}
200200
}

src/libcore/num/uint-template/u16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl NumCast for u16 {
2424
* Cast `n` to a `u16`
2525
*/
2626
#[inline(always)]
27-
static pure fn from<N:NumCast>(n: N) -> u16 { n.to_u16() }
27+
pure fn from<N:NumCast>(n: N) -> u16 { n.to_u16() }
2828

2929
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
3030
#[inline(always)] pure fn to_u16(&self) -> u16 { *self }

src/libcore/num/uint-template/u32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl NumCast for u32 {
2424
* Cast `n` to a `u32`
2525
*/
2626
#[inline(always)]
27-
static pure fn from<N:NumCast>(n: N) -> u32 { n.to_u32() }
27+
pure fn from<N:NumCast>(n: N) -> u32 { n.to_u32() }
2828

2929
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
3030
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

src/libcore/num/uint-template/u64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl NumCast for u64 {
2424
* Cast `n` to a `u64`
2525
*/
2626
#[inline(always)]
27-
static pure fn from<N:NumCast>(n: N) -> u64 { n.to_u64() }
27+
pure fn from<N:NumCast>(n: N) -> u64 { n.to_u64() }
2828

2929
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
3030
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

0 commit comments

Comments
 (0)