Skip to content

Commit 2572e80

Browse files
committed
Remove 'let' syntax for struct fields
1 parent 14303ba commit 2572e80

File tree

129 files changed

+322
-325
lines changed

Some content is hidden

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

129 files changed

+322
-325
lines changed

src/libcore/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U {
9898
}
9999

100100
struct PortPtr<T:send> {
101-
let po: *rust_port;
101+
po: *rust_port,
102102
drop unsafe {
103103
do task::unkillable {
104104
// Once the port is detached it's guaranteed not to receive further
@@ -138,7 +138,7 @@ fn PortPtr<T: send>(po: *rust_port) -> PortPtr<T> {
138138
fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
139139

140140
struct PortRef {
141-
let p: *rust_port;
141+
p: *rust_port,
142142
drop {
143143
if !ptr::is_null(self.p) {
144144
rustrt::rust_port_drop(self.p);

src/libcore/gc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export cleanup_stack_for_failure;
3636

3737
// Mirrors rust_stack.h stk_seg
3838
struct StackSegment {
39-
let prev: *StackSegment;
40-
let next: *StackSegment;
41-
let end: uintptr_t;
39+
prev: *StackSegment,
40+
next: *StackSegment,
41+
end: uintptr_t,
4242
// And other fields which we don't care about...
4343
}
4444

src/libcore/io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<T: Reader, C> {base: T, cleanup: C}: Reader {
246246
}
247247

248248
struct FILERes {
249-
let f: *libc::FILE;
249+
f: *libc::FILE,
250250
drop { libc::fclose(self.f); }
251251
}
252252

@@ -422,7 +422,7 @@ impl fd_t: Writer {
422422
}
423423

424424
struct FdRes {
425-
let fd: fd_t;
425+
fd: fd_t,
426426
drop { libc::close(self.fd); }
427427
}
428428

@@ -778,7 +778,7 @@ mod fsync {
778778

779779
// Artifacts that need to fsync on destruction
780780
struct Res<t> {
781-
let arg: Arg<t>;
781+
arg: Arg<t>,
782782
drop {
783783
match self.arg.opt_level {
784784
option::None => (),

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn test_unwrap_str() {
292292
#[test]
293293
fn test_unwrap_resource() {
294294
struct R {
295-
let i: @mut int;
295+
i: @mut int,
296296
drop { *(self.i) += 1; }
297297
}
298298

src/libcore/pipes.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl State: Eq {
134134
struct BufferHeader {
135135
// Tracks whether this buffer needs to be freed. We can probably
136136
// get away with restricting it to 0 or 1, if we're careful.
137-
let mut ref_count: int;
137+
mut ref_count: int,
138138

139139
// We may want a drop, and to be careful about stringing this
140140
// thing along.
@@ -158,12 +158,12 @@ type Buffer<T: send> = {
158158
};
159159

160160
struct PacketHeader {
161-
let mut state: State;
162-
let mut blocked_task: *rust_task;
161+
mut state: State,
162+
mut blocked_task: *rust_task,
163163

164164
// This is a reinterpret_cast of a ~buffer, that can also be cast
165165
// to a buffer_header if need be.
166-
let mut buffer: *libc::c_void;
166+
mut buffer: *libc::c_void,
167167

168168
// Returns the old state.
169169
unsafe fn mark_blocked(this: *rust_task) -> State {
@@ -374,7 +374,7 @@ unsafe fn get_buffer<T: send>(p: *PacketHeader) -> ~Buffer<T> {
374374

375375
// This could probably be done with SharedMutableState to avoid move_it!().
376376
struct BufferResource<T: send> {
377-
let buffer: ~Buffer<T>;
377+
buffer: ~Buffer<T>,
378378

379379
drop unsafe {
380380
let b = move_it!(self.buffer);
@@ -779,8 +779,8 @@ fn send_packet<T: send>(p: *packet<T>) -> SendPacket<T> {
779779
}
780780

781781
struct SendPacketBuffered<T: send, Tbuffer: send> {
782-
let mut p: Option<*Packet<T>>;
783-
let mut buffer: Option<BufferResource<Tbuffer>>;
782+
mut p: Option<*Packet<T>>,
783+
mut buffer: Option<BufferResource<Tbuffer>>,
784784
drop {
785785
//if self.p != none {
786786
// debug!("drop send %?", option::get(self.p));
@@ -860,8 +860,8 @@ fn recv_packet<T: send>(p: *packet<T>) -> RecvPacket<T> {
860860
}
861861

862862
struct RecvPacketBuffered<T: send, Tbuffer: send> : Selectable {
863-
let mut p: Option<*Packet<T>>;
864-
let mut buffer: Option<BufferResource<Tbuffer>>;
863+
mut p: Option<*Packet<T>>,
864+
mut buffer: Option<BufferResource<Tbuffer>>,
865865
drop {
866866
//if self.p != none {
867867
// debug!("drop recv %?", option::get(self.p));
@@ -1098,7 +1098,7 @@ impl<T: send> Port<T>: Recv<T> {
10981098

10991099
/// Treat many ports as one.
11001100
struct PortSet<T: send> : Recv<T> {
1101-
let mut ports: ~[pipes::Port<T>];
1101+
mut ports: ~[pipes::Port<T>],
11021102

11031103
fn add(+port: pipes::Port<T>) {
11041104
vec::push(self.ports, port)

src/libcore/priv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ unsafe fn weaken_task(f: fn(comm::Port<()>)) {
195195
f(po);
196196

197197
struct Unweaken {
198-
let ch: comm::Chan<()>;
198+
ch: comm::Chan<()>,
199199
drop unsafe {
200200
rustrt::rust_task_unweaken(unsafe::reinterpret_cast(&self.ch));
201201
}

src/libcore/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl Rng {
244244
}
245245

246246
struct RandRes {
247-
let c: *rctx;
247+
c: *rctx,
248248
drop { rustrt::rand_free(self.c); }
249249
}
250250

src/libcore/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ fn start_program(prog: &str, args: &[~str]) -> Program {
227227
libc::fclose(r.err_file);
228228
}
229229
struct ProgRes {
230-
let r: ProgRepr;
230+
r: ProgRepr,
231231
drop { destroy_repr(&self.r); }
232232
}
233233

src/libcore/stackwalk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use sys::size_of;
77
type Word = uint;
88

99
struct Frame {
10-
let fp: *Word;
10+
fp: *Word
1111
}
1212

1313
fn Frame(fp: *Word) -> Frame {

src/libcore/task.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ fn get_task() -> Task {
610610
*/
611611
unsafe fn unkillable<U>(f: fn() -> U) -> U {
612612
struct AllowFailure {
613-
let t: *rust_task;
613+
t: *rust_task,
614614
drop { rustrt::rust_task_allow_kill(self.t); }
615615
}
616616

@@ -629,7 +629,7 @@ unsafe fn unkillable<U>(f: fn() -> U) -> U {
629629
/// The inverse of unkillable. Only ever to be used nested in unkillable().
630630
unsafe fn rekillable<U>(f: fn() -> U) -> U {
631631
struct DisallowFailure {
632-
let t: *rust_task;
632+
t: *rust_task,
633633
drop { rustrt::rust_task_inhibit_kill(self.t); }
634634
}
635635

@@ -651,7 +651,7 @@ unsafe fn rekillable<U>(f: fn() -> U) -> U {
651651
*/
652652
unsafe fn atomically<U>(f: fn() -> U) -> U {
653653
struct DeferInterrupts {
654-
let t: *rust_task;
654+
t: *rust_task,
655655
drop {
656656
rustrt::rust_task_allow_yield(self.t);
657657
rustrt::rust_task_allow_kill(self.t);
@@ -948,13 +948,13 @@ fn each_ancestor(list: &mut AncestorList,
948948

949949
// One of these per task.
950950
struct TCB {
951-
let me: *rust_task;
951+
me: *rust_task,
952952
// List of tasks with whose fates this one's is intertwined.
953-
let tasks: TaskGroupArc; // 'none' means the group has failed.
953+
tasks: TaskGroupArc, // 'none' means the group has failed.
954954
// Lists of tasks who will kill us if they fail, but whom we won't kill.
955-
let mut ancestors: AncestorList;
956-
let is_main: bool;
957-
let notifier: Option<AutoNotify>;
955+
mut ancestors: AncestorList,
956+
is_main: bool,
957+
notifier: Option<AutoNotify>,
958958
// Runs on task exit.
959959
drop {
960960
// If we are failing, the whole taskgroup needs to die.
@@ -995,8 +995,8 @@ fn TCB(me: *rust_task, +tasks: TaskGroupArc, +ancestors: AncestorList,
995995
}
996996

997997
struct AutoNotify {
998-
let notify_chan: comm::Chan<Notification>;
999-
let mut failed: bool;
998+
notify_chan: comm::Chan<Notification>,
999+
mut failed: bool,
10001000
drop {
10011001
let result = if self.failed { Failure } else { Success };
10021002
comm::send(self.notify_chan, Exit(get_task(), result));

src/libcore/unsafe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ extern mod rustrt {
280280
}
281281

282282
struct LittleLock {
283-
let l: rust_little_lock;
283+
l: rust_little_lock,
284284
drop { rustrt::rust_destroy_little_lock(self.l); }
285285
}
286286

@@ -294,7 +294,7 @@ impl LittleLock {
294294
#[inline(always)]
295295
unsafe fn lock<T>(f: fn() -> T) -> T {
296296
struct Unlock {
297-
let l: rust_little_lock;
297+
l: rust_little_lock,
298298
drop { rustrt::rust_unlock_little_lock(self.l); }
299299
}
300300

src/libstd/c_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum CVec<T> {
4343
}
4444

4545
struct DtorRes {
46-
let dtor: Option<fn@()>;
46+
dtor: Option<fn@()>,
4747
drop {
4848
match self.dtor {
4949
option::None => (),

src/libstd/net_tcp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern mod rustrt {
3939
* data structure that is used for read/write operations over a TCP stream.
4040
*/
4141
struct TcpSocket {
42-
let socket_data: @TcpSocketData;
42+
socket_data: @TcpSocketData,
4343
drop {
4444
unsafe {
4545
tear_down_socket_data(self.socket_data)
@@ -60,7 +60,7 @@ fn TcpSocket(socket_data: @TcpSocketData) -> TcpSocket {
6060
* satisfy both the `io::reader` and `io::writer` traits.
6161
*/
6262
struct TcpSocketBuf {
63-
let data: @TcpBufferedSocketData;
63+
data: @TcpBufferedSocketData,
6464
}
6565

6666
fn TcpSocketBuf(data: @TcpBufferedSocketData) -> TcpSocketBuf {

src/libsyntax/ext/pipes/proto.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ fn protocol_(name: ~str, span: span) -> protocol_ {
129129
}
130130

131131
struct protocol_ {
132-
let name: ~str;
133-
let span: span;
134-
let states: DVec<state>;
132+
name: ~str,
133+
span: span,
134+
states: DVec<state>,
135135

136-
let mut bounded: Option<bool>;
136+
mut bounded: Option<bool>,
137137

138138
/// Get a state.
139139
fn get_state(name: ~str) -> state {

src/libsyntax/parse/parser.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,21 +213,21 @@ fn parser(sess: parse_sess, cfg: ast::crate_cfg,
213213
}
214214

215215
struct parser {
216-
let sess: parse_sess;
217-
let cfg: crate_cfg;
218-
let file_type: file_type;
219-
let mut token: token::token;
220-
let mut span: span;
221-
let mut last_span: span;
222-
let mut buffer: [mut {tok: token::token, sp: span}]/4;
223-
let mut buffer_start: int;
224-
let mut buffer_end: int;
225-
let mut restriction: restriction;
226-
let mut quote_depth: uint; // not (yet) related to the quasiquoter
227-
let reader: reader;
228-
let interner: interner<@~str>;
229-
let keywords: hashmap<~str, ()>;
230-
let restricted_keywords: hashmap<~str, ()>;
216+
sess: parse_sess,
217+
cfg: crate_cfg,
218+
file_type: file_type,
219+
mut token: token::token,
220+
mut span: span,
221+
mut last_span: span,
222+
mut buffer: [mut {tok: token::token, sp: span}]/4,
223+
mut buffer_start: int,
224+
mut buffer_end: int,
225+
mut restriction: restriction,
226+
mut quote_depth: uint, // not (yet) related to the quasiquoter
227+
reader: reader,
228+
interner: interner<@~str>,
229+
keywords: hashmap<~str, ()>,
230+
restricted_keywords: hashmap<~str, ()>,
231231

232232
drop {} /* do not copy the parser; its state is tied to outside state */
233233

@@ -2726,8 +2726,7 @@ struct parser {
27262726
}
27272727

27282728
fn parse_single_class_item(vis: visibility) -> @class_member {
2729-
if (self.eat_keyword(~"let") ||
2730-
self.token_is_keyword(~"mut", copy self.token) ||
2729+
if (self.token_is_keyword(~"mut", copy self.token) ||
27312730
!self.is_any_keyword(copy self.token)) &&
27322731
!self.token_is_pound_or_doc_comment(self.token) {
27332732
let a_var = self.parse_instance_var(vis);

src/rustc/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
241241
};
242242
243243
struct finally {
244-
let ch: comm::Chan<monitor_msg>;
244+
ch: comm::Chan<monitor_msg>,
245245
drop { comm::send(self.ch, done); }
246246
}
247247

src/rustc/lib/llvm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] unsafe {
11751175
/* Memory-managed interface to target data. */
11761176

11771177
struct target_data_res {
1178-
let TD: TargetDataRef;
1178+
TD: TargetDataRef,
11791179
drop { llvm::LLVMDisposeTargetData(self.TD); }
11801180
}
11811181

@@ -1196,7 +1196,7 @@ fn mk_target_data(string_rep: ~str) -> target_data {
11961196
/* Memory-managed interface to pass managers. */
11971197

11981198
struct pass_manager_res {
1199-
let PM: PassManagerRef;
1199+
PM: PassManagerRef,
12001200
drop { llvm::LLVMDisposePassManager(self.PM); }
12011201
}
12021202

@@ -1216,7 +1216,7 @@ fn mk_pass_manager() -> pass_manager {
12161216
/* Memory-managed interface to object files. */
12171217

12181218
struct object_file_res {
1219-
let ObjectFile: ObjectFileRef;
1219+
ObjectFile: ObjectFileRef,
12201220
drop { llvm::LLVMDisposeObjectFile(self.ObjectFile); }
12211221
}
12221222

@@ -1237,7 +1237,7 @@ fn mk_object_file(llmb: MemoryBufferRef) -> Option<object_file> {
12371237
/* Memory-managed interface to section iterators. */
12381238

12391239
struct section_iter_res {
1240-
let SI: SectionIteratorRef;
1240+
SI: SectionIteratorRef,
12411241
drop { llvm::LLVMDisposeSectionIterator(self.SI); }
12421242
}
12431243

src/rustc/metadata/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ fn def_like_to_def(def_like: def_like) -> ast::def {
440440
// A path.
441441
struct path_entry {
442442
// The full path, separated by '::'.
443-
let path_string: ~str;
443+
path_string: ~str,
444444
// The definition, implementation, or field that this path corresponds to.
445-
let def_like: def_like;
445+
def_like: def_like,
446446
}
447447

448448
fn path_entry(path_string: ~str, def_like: def_like) -> path_entry {

0 commit comments

Comments
 (0)