Skip to content

Commit 3b95171

Browse files
brsongraydon
authored andcommitted
---
yaml --- r: 1521 b: refs/heads/master c: bed457d h: refs/heads/master i: 1519: 5d99d43 v: v3
1 parent bce47a1 commit 3b95171

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 330c9c6c3592496462dbf9aa716a37e048b00172
2+
refs/heads/master: bed457d3a7244b317c54962d80b460294b846c27

trunk/src/lib/io.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,11 @@ fn new_buf_reader(str path) -> buf_reader {
8585
ret fd_buf_reader(fd, new_buf());
8686
}
8787

88-
/**
89-
* FIXME (issue #150): This should be
90-
*
91-
* type fileflag = tag(append(), create(), truncate());
92-
*
93-
* but then the tag value ctors are not found from crate-importers of std, so
94-
* we manually simulate the enum below.
95-
*/
96-
type fileflag = uint;
97-
fn append() -> uint { ret 0u; }
98-
fn create() -> uint { ret 1u; }
99-
fn truncate() -> uint { ret 2u; }
88+
tag fileflag {
89+
append;
90+
create;
91+
truncate;
92+
}
10093

10194
fn new_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
10295

@@ -129,13 +122,9 @@ fn new_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
129122

130123
for (fileflag f in flags) {
131124
alt (f) {
132-
// FIXME (issue #150): cf comment above defn of fileflag type
133-
//case (append()) { fflags |= os.libc_constants.O_APPEND(); }
134-
//case (create()) { fflags |= os.libc_constants.O_CREAT(); }
135-
//case (truncate()) { fflags |= os.libc_constants.O_TRUNC(); }
136-
case (0u) { fflags |= os.libc_constants.O_APPEND(); }
137-
case (1u) { fflags |= os.libc_constants.O_CREAT(); }
138-
case (2u) { fflags |= os.libc_constants.O_TRUNC(); }
125+
case (append) { fflags |= os.libc_constants.O_APPEND(); }
126+
case (create) { fflags |= os.libc_constants.O_CREAT(); }
127+
case (truncate) { fflags |= os.libc_constants.O_TRUNC(); }
139128
}
140129
}
141130

trunk/src/test/run-pass/lib-io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_simple(str tmpfilebase) {
1111
log frood;
1212

1313
{
14-
let io.buf_writer out = io.new_buf_writer(tmpfile, vec(io.create()));
14+
let io.buf_writer out = io.new_buf_writer(tmpfile, vec(io.create));
1515
out.write(_str.bytes(frood));
1616
}
1717

0 commit comments

Comments
 (0)