Skip to content

Commit 5f69a58

Browse files
author
blake2-ppc
committed
std::vec: Remove the function same_length
The basic construct x.len() == y.len() is just as simple. This function used to be a precondition (not sure about the terminology), so it had to be a function. This is not relevant any more.
1 parent 77dff93 commit 5f69a58

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub trait Combine {
8888
// future we could allow type parameters to declare a
8989
// variance.
9090

91-
if vec::same_length(as_, bs) {
91+
if as_.len() == bs.len() {
9292
result::fold_(as_.iter().zip(bs.iter())
9393
.map(|(a, b)| eq_tys(self, *a, *b)))
9494
.then(|| Ok(as_.to_owned()))
@@ -419,7 +419,7 @@ pub fn super_fn_sigs<C:Combine>(
419419
this: &C, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
420420

421421
fn argvecs<C:Combine>(this: &C, a_args: &[ty::t], b_args: &[ty::t]) -> cres<~[ty::t]> {
422-
if vec::same_length(a_args, b_args) {
422+
if a_args.len() == b_args.len() {
423423
result::collect(a_args.iter().zip(b_args.iter())
424424
.map(|(a, b)| this.args(*a, *b)))
425425
} else {

src/libstd/vec.rs

-5
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ use unstable::raw::{Box, Repr, Slice, Vec};
123123
use vec;
124124
use util;
125125

126-
/// Returns true if two vectors have the same length
127-
pub fn same_length<T, U>(xs: &[T], ys: &[U]) -> bool {
128-
xs.len() == ys.len()
129-
}
130-
131126
/**
132127
* Creates and initializes an owned vector.
133128
*

0 commit comments

Comments
 (0)