Skip to content

Commit 2c78169

Browse files
committed
Merge pull request #4644 from martica/camel-case-option
Update more uses of Option, Some and None to camel case
2 parents 41adf9d + c89afc3 commit 2c78169

File tree

19 files changed

+50
-50
lines changed

19 files changed

+50
-50
lines changed

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub pure fn chain_ref<T, U>(opt: &Option<T>,
149149
#[inline(always)]
150150
pub pure fn or<T>(opta: Option<T>, optb: Option<T>) -> Option<T> {
151151
/*!
152-
* Returns the leftmost some() value, or none if both are none.
152+
* Returns the leftmost Some() value, or None if both are None.
153153
*/
154154
match move opta {
155155
Some(move opta) => Some(move opta),

src/librustc/middle/borrowck/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ variables from reassigned if there may be pointers to their interior)
114114
Finally, in some cases, both dangers can arise. For example, something
115115
like the following:
116116
117-
let mut x = ~some(5);
117+
let mut x = ~Some(5);
118118
match x {
119-
~some(ref y) => { ... }
120-
~none => { ... }
119+
~Some(ref y) => { ... }
120+
~None => { ... }
121121
}
122122
123123
In this case, if `x` to be reassigned or `*x` were to be mutated, then

src/librustc/middle/borrowck/preserve.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ priv impl &preserve_ctxt {
226226
//
227227
// As an example, consider this scenario:
228228
//
229-
// let mut x = @some(3);
230-
// match *x { Some(y) {...} none {...} }
229+
// let mut x = @Some(3);
230+
// match *x { Some(y) {...} None {...} }
231231
//
232232
// Technically, the value `x` need only be rooted
233233
// in the `some` arm. However, we evaluate `x` in trans
@@ -236,8 +236,8 @@ priv impl &preserve_ctxt {
236236
//
237237
// As a second example, consider *this* scenario:
238238
//
239-
// let x = @mut @some(3);
240-
// match x { @@some(y) {...} @@none {...} }
239+
// let x = @mut @Some(3);
240+
// match x { @@Some(y) {...} @@None {...} }
241241
//
242242
// Here again, `x` need only be rooted in the `some` arm.
243243
// In this case, the value which needs to be rooted is

src/librustc/middle/trans/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
100100
// Replace any typedef'd types with their equivalent non-typedef
101101
// type. This ensures that all LLVM nominal types that contain
102102
// Rust types are defined as the same LLVM types. If we don't do
103-
// this then, e.g. `option<{myfield: bool}>` would be a different
104-
// type than `option<myrec>`.
103+
// this then, e.g. `Option<{myfield: bool}>` would be a different
104+
// type than `Option<myrec>`.
105105
let t_norm = ty::normalize_ty(cx.tcx, t);
106106

107107
if t != t_norm {

src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,7 @@ fn check_instantiable(tcx: ty::ctxt,
26962696
if !ty::is_instantiable(tcx, item_ty) {
26972697
tcx.sess.span_err(sp, fmt!("this type cannot be instantiated \
26982698
without an instance of itself; \
2699-
consider using `option<%s>`",
2699+
consider using `Option<%s>`",
27002700
ppaux::ty_to_str(tcx, item_ty)));
27012701
}
27022702
}

src/librustc/middle/typeck/infer/lattice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ fn lattice_var_and_t<L:LatticeDir Combine,
492492
match self.bnd(a_bounds) {
493493
Some(ref a_bnd) => {
494494
// If a has an upper bound, return the LUB(a.ub, b)
495-
debug!("bnd=some(%s)", a_bnd.inf_str(self.infcx()));
495+
debug!("bnd=Some(%s)", a_bnd.inf_str(self.infcx()));
496496
lattice_dir_op(a_bnd, b)
497497
}
498498
None => {
499499
// If a does not have an upper bound, make b the upper bound of a
500500
// and then return b.
501-
debug!("bnd=none");
501+
debug!("bnd=None");
502502
let a_bounds = self.with_bnd(a_bounds, *b);
503503
do self.combine_fields().bnds(&a_bounds.lb, &a_bounds.ub).then {
504504
self.infcx().set(vb, a_id, Root(a_bounds, nde_a.rank));

src/libstd/net_tcp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn read_future(sock: &TcpSocket, timeout_msecs: uint)
468468
* }
469469
* // this callback is ran when a new connection arrives
470470
* {|new_conn, kill_ch|
471-
* let cont_po = core::comm::port::<option<tcp_err_data>>();
471+
* let cont_po = core::comm::port::<Option<tcp_err_data>>();
472472
* let cont_ch = core::comm::chan(cont_po);
473473
* task::spawn {||
474474
* let accept_result = net::tcp::accept(new_conn);
@@ -484,9 +484,9 @@ fn read_future(sock: &TcpSocket, timeout_msecs: uint)
484484
* };
485485
* match core::comm::recv(cont_po) {
486486
* // shut down listen()
487-
* some(err_data) { core::comm::send(kill_chan, some(err_data)) }
487+
* Some(err_data) { core::comm::send(kill_chan, Some(err_data)) }
488488
* // wait for next connection
489-
* none {}
489+
* None {}
490490
* }
491491
* };
492492
* ~~~~~~~~~~~
@@ -593,7 +593,7 @@ pub fn accept(new_conn: TcpNewConnection)
593593
* callback's arguments are:
594594
* * `new_conn` - an opaque type that can be passed to
595595
* `net::tcp::accept` in order to be converted to a `tcp_socket`.
596-
* * `kill_ch` - channel of type `core::comm::chan<option<tcp_err_data>>`.
596+
* * `kill_ch` - channel of type `core::comm::chan<Option<tcp_err_data>>`.
597597
* this channel can be used to send a message to cause `listen` to begin
598598
* closing the underlying libuv data structures.
599599
*

src/libstd/rope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ pub mod node {
893893
* # Return value
894894
*
895895
* * `option::None` if no transformation happened
896-
* * `option::some(x)` otherwise, in which case `x` has the same contents
896+
* * `option::Some(x)` otherwise, in which case `x` has the same contents
897897
* as `node` bot lower height and/or fragmentation.
898898
*/
899899
pub fn bal(node: @Node) -> Option<@Node> {

src/libstd/timer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ pub fn sleep(iotask: IoTask, msecs: uint) {
100100
}
101101
102102
/**
103-
* Receive on a port for (up to) a specified time, then return an `option<T>`
103+
* Receive on a port for (up to) a specified time, then return an `Option<T>`
104104
*
105105
* This call will block to receive on the provided port for up to the
106106
* specified timeout. Depending on whether the provided port receives in that
107-
* time period, `recv_timeout` will return an `option<T>` representing the
107+
* time period, `recv_timeout` will return an `Option<T>` representing the
108108
* result.
109109
*
110110
* # Arguments
@@ -115,9 +115,9 @@ pub fn sleep(iotask: IoTask, msecs: uint) {
115115
*
116116
* # Returns
117117
*
118-
* An `option<T>` representing the outcome of the call. If the call `recv`'d
118+
* An `Option<T>` representing the outcome of the call. If the call `recv`'d
119119
* on the provided port in the allotted timeout period, then the result will
120-
* be a `some(T)`. If not, then `none` will be returned.
120+
* be a `Some(T)`. If not, then `None` will be returned.
121121
*/
122122
pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
123123
msecs: uint,
@@ -255,7 +255,7 @@ mod test {
255255
};
256256

257257
match recv_timeout(hl_loop, 10u, test_po) {
258-
some(val) => {
258+
Some(val) => {
259259
assert val == expected;
260260
successes += 1;
261261
}

src/test/compile-fail/issue-2354.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
xfailed for now (see Issue #2354)
1616
*/
1717
fn foo() { //~ ERROR this open brace is not closed
18-
match some(x) {
19-
some(y) { fail; }
20-
none { fail; }
18+
match Some(x) {
19+
Some(y) { fail; }
20+
None { fail; }
2121
}
2222

2323
fn bar() {

0 commit comments

Comments
 (0)