Skip to content

Commit 13bcc73

Browse files
committed
core: Rename vec::position_elt to position_elem
1 parent cab0214 commit 13bcc73

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ for the parameter list, as in `{|| ...}`.
921921
Partial application is done using the `bind` keyword in Rust.
922922

923923
~~~~
924-
let daynum = bind vec::position_elt(["mo", "tu", "we", "do",
925-
"fr", "sa", "su"], _);
924+
let daynum = bind vec::position_elem(["mo", "tu", "we", "do",
925+
"fr", "sa", "su"], _);
926926
~~~~
927927

928928
Binding a function produces a boxed closure (`fn@` type) in which some

src/libcore/vec.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export find;
5050
export find_from;
5151
export rfind;
5252
export rfind_from;
53-
export position_elt;
53+
export position_elem;
5454
export position;
5555
export position_from;
56-
export position_elt;
56+
export position_elem;
5757
export rposition;
5858
export rposition_from;
5959
export unzip;
@@ -613,7 +613,7 @@ fn rfind_from<T: copy>(v: [const T], start: uint, end: uint,
613613
}
614614

615615
#[doc = "Find the first index containing a matching value"]
616-
fn position_elt<T>(v: [const T], x: T) -> option<uint> {
616+
fn position_elem<T>(v: [const T], x: T) -> option<uint> {
617617
position(v) { |y| x == y }
618618
}
619619

@@ -645,7 +645,7 @@ fn position_from<T>(v: [const T], start: uint, end: uint,
645645
}
646646

647647
#[doc = "Find the last index containing a matching value"]
648-
fn rposition_elt<T>(v: [const T], x: T) -> option<uint> {
648+
fn rposition_elem<T>(v: [const T], x: T) -> option<uint> {
649649
rposition(v) { |y| x == y }
650650
}
651651

@@ -1439,14 +1439,14 @@ mod tests {
14391439
}
14401440

14411441
#[test]
1442-
fn test_position_elt() {
1443-
assert position_elt([], 1) == none;
1442+
fn test_position_elem() {
1443+
assert position_elem([], 1) == none;
14441444

14451445
let v1 = [1, 2, 3, 3, 2, 5];
1446-
assert position_elt(v1, 1) == some(0u);
1447-
assert position_elt(v1, 2) == some(1u);
1448-
assert position_elt(v1, 5) == some(5u);
1449-
assert position_elt(v1, 4) == none;
1446+
assert position_elem(v1, 1) == some(0u);
1447+
assert position_elem(v1, 2) == some(1u);
1448+
assert position_elem(v1, 5) == some(5u);
1449+
assert position_elem(v1, 4) == none;
14501450
}
14511451

14521452
#[test]

src/rustc/middle/kind.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
9191
some(last_use::closes_over(vars)) { vars }
9292
none { [] }
9393
};
94-
if option::is_some(vec::position_elt(last_uses, id)) { cont; }
94+
if option::is_some(
95+
vec::position_elem(last_uses, id)) { cont; }
9596
}
9697
let ty = ty::node_id_to_type(cx.tcx, id);
9798
checker(cx, ty, span);

src/rustc/middle/trans/shape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
393393
}
394394
ty::ty_param(n, _) {
395395
// Find the type parameter in the parameter list.
396-
alt vec::position_elt(ty_param_map, n) {
396+
alt vec::position_elem(ty_param_map, n) {
397397
some(i) { [shape_var, i as u8] }
398398
none { fail "ty param not found in ty_param_map"; }
399399
}

0 commit comments

Comments
 (0)