File tree Expand file tree Collapse file tree 7 files changed +14
-14
lines changed Expand file tree Collapse file tree 7 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ Returns:
123
123
124
124
An u8 whose first bit is set if `if_true(v)` holds
125
125
*/
126
- fn to_bit ( v : t ) -> u8 { if v { 1u8 } else { 0u8 } }
126
+ pure fn to_bit ( v : t ) -> u8 { if v { 1u8 } else { 0u8 } }
127
127
128
128
// Local Variables:
129
129
// mode: rust;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Function: ptr_eq
10
10
11
11
Determine if two shared boxes point to the same object
12
12
*/
13
- fn ptr_eq < T > ( a : @T , b : @T ) -> bool {
13
+ pure fn ptr_eq < T > ( a : @T , b : @T ) -> bool {
14
14
// FIXME: ptr::addr_of
15
15
unsafe {
16
16
let a_ptr: uint = unsafe :: reinterpret_cast ( a) ;
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ pure fn to_digit(c: char) -> u8 unsafe {
122
122
Convert a char to the corresponding digit. Returns none when the
123
123
character is not a valid hexadecimal digit.
124
124
*/
125
- fn maybe_digit ( c : char ) -> option:: t < u8 > {
125
+ pure fn maybe_digit ( c : char ) -> option:: t < u8 > {
126
126
alt c {
127
127
'0' to ' 9 ' { option : : some ( c as u8 - ( '0' as u8 ) ) }
128
128
'a' to 'z' { option:: some ( c as u8 + 10u8 - ( 'a' as u8 ) ) }
@@ -143,7 +143,7 @@ fn maybe_digit(c: char) -> option::t<u8> {
143
143
Returns:
144
144
-1 if a<b, 0 if a==b, +1 if a>b
145
145
*/
146
- fn cmp ( a : char , b : char ) -> int {
146
+ pure fn cmp ( a : char , b : char ) -> int {
147
147
ret if b > a { -1 }
148
148
else if b < a { 1 }
149
149
else { 0 }
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ Failure:
30
30
31
31
Fails if the value equals `none`.
32
32
*/
33
- fn get < copy T > ( opt : t < T > ) -> T {
33
+ pure fn get<copy T >( opt: t<T >) -> T {
34
34
alt opt { some( x) { ret x; } none. { fail "option none" ; } }
35
35
}
36
36
@@ -61,7 +61,7 @@ Function: from_maybe
61
61
62
62
Returns the contained value or a default
63
63
*/
64
- fn from_maybe < T > ( def : T , opt : t < T > ) -> T {
64
+ pure fn from_maybe<T >( def: T , opt: t<T >) -> T {
65
65
alt opt { some( x) { x } none. { def } }
66
66
}
67
67
Original file line number Diff line number Diff line change @@ -26,14 +26,14 @@ Function: eq
26
26
27
27
Bytewise string equality
28
28
*/
29
- fn eq ( & & a: str , & & b: str ) -> bool { a == b }
29
+ pure fn eq ( & & a: str , & & b: str ) -> bool { a == b }
30
30
31
31
/*
32
32
Function: lteq
33
33
34
34
Bytewise less than or equal
35
35
*/
36
- fn lteq ( & & a: str , & & b: str ) -> bool { a <= b }
36
+ pure fn lteq ( & & a: str , & & b: str ) -> bool { a <= b }
37
37
38
38
/*
39
39
Function: hash
@@ -131,7 +131,7 @@ Function: byte_len
131
131
132
132
Returns the length in bytes of a string
133
133
*/
134
- fn byte_len ( s : str ) -> uint unsafe {
134
+ pure fn byte_len ( s : str ) -> uint unsafe {
135
135
let v: [ u8 ] = unsafe :: reinterpret_cast ( s) ;
136
136
let vlen = vec:: len ( v) ;
137
137
unsafe :: leak ( v) ;
@@ -261,7 +261,7 @@ Function: utf8_char_width
261
261
262
262
FIXME: What does this function do?
263
263
*/
264
- fn utf8_char_width ( b : u8 ) -> uint {
264
+ pure fn utf8_char_width ( b : u8 ) -> uint {
265
265
let byte: uint = b as uint ;
266
266
if byte < 128 u { ret 1 u; }
267
267
if byte < 192 u {
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ Function: last_os_error
42
42
Get a string representing the platform-dependent last error
43
43
*/
44
44
fn last_os_error ( ) -> str {
45
- ret rustrt:: last_os_error ( ) ;
45
+ rustrt:: last_os_error ( )
46
46
}
47
47
48
48
/*
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ Returns the first element of a vector
181
181
Predicates:
182
182
<is_not_empty> (v)
183
183
*/
184
- fn head < copy T > ( v : [ const T ] ) : is_not_empty( v ) -> T { ret v[ 0 ] ; }
184
+ pure fn head < copy T > ( v : [ const T ] ) : is_not_empty( v ) -> T { ret v[ 0 ] ; }
185
185
186
186
/*
187
187
Function: tail
@@ -221,7 +221,7 @@ Returns:
221
221
An option containing the last element of `v` if `v` is not empty, or
222
222
none if `v` is empty.
223
223
*/
224
- fn last < copy T > ( v : [ const T ] ) -> option:: t < T > {
224
+ pure fn last < copy T > ( v : [ const T ] ) -> option:: t < T > {
225
225
if len ( v) == 0 u { ret none; }
226
226
ret some( v[ len ( v) - 1 u] ) ;
227
227
}
@@ -234,7 +234,7 @@ Returns the last element of a non-empty vector `v`
234
234
Predicates:
235
235
<is_not_empty> (v)
236
236
*/
237
- fn last_total < copy T > ( v : [ const T ] ) : is_not_empty( v ) -> T {
237
+ pure fn last_total < copy T > ( v : [ const T ] ) : is_not_empty( v ) -> T {
238
238
ret v[ len ( v) - 1 u] ;
239
239
}
240
240
You can’t perform that action at this time.
0 commit comments