about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2015-03-24 16:53:34 -0700
committerTamir Duberstein <tamird@gmail.com>2015-04-14 20:26:03 -0700
commit29ac04402d53d358a1f6200bea45a301ff05b2d1 (patch)
treeb54ff9c5f2b99a0197147875cf3c5377d8a09cf4
parent16e1fcead14628701e1b10b9d00c898d748db2ed (diff)
Positive case of `len()` -> `is_empty()`
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
-rw-r--r--src/compiletest/runtest.rs4
-rw-r--r--src/doc/reference.md2
-rw-r--r--src/libcollections/btree/map.rs2
-rw-r--r--src/libcollections/btree/node.rs2
-rw-r--r--src/libcore/slice.rs18
-rw-r--r--src/libcore/str/mod.rs2
-rw-r--r--src/libcore/str/pattern.rs2
-rw-r--r--src/liblog/directive.rs2
-rw-r--r--src/librustc/metadata/creader.rs2
-rw-r--r--src/librustc/metadata/decoder.rs4
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/librustc/metadata/loader.rs2
-rw-r--r--src/librustc/middle/check_match.rs8
-rw-r--r--src/librustc/middle/infer/error_reporting.rs4
-rw-r--r--src/librustc/middle/infer/region_inference/graphviz.rs2
-rw-r--r--src/librustc/middle/liveness.rs4
-rw-r--r--src/librustc/middle/subst.rs2
-rw-r--r--src/librustc/middle/traits/fulfill.rs2
-rw-r--r--src/librustc/middle/traits/select.rs4
-rw-r--r--src/librustc/middle/ty.rs8
-rw-r--r--src/librustc/session/config.rs2
-rw-r--r--src/librustc/util/ppaux.rs2
-rw-r--r--src/librustc_driver/driver.rs4
-rw-r--r--src/librustc_driver/lib.rs2
-rw-r--r--src/librustc_driver/pretty.rs2
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs2
-rw-r--r--src/librustc_resolve/lib.rs4
-rw-r--r--src/librustc_resolve/resolve_imports.rs2
-rw-r--r--src/librustc_trans/back/link.rs2
-rw-r--r--src/librustc_trans/save/mod.rs6
-rw-r--r--src/librustc_trans/trans/_match.rs4
-rw-r--r--src/librustc_trans/trans/adt.rs4
-rw-r--r--src/librustc_trans/trans/cabi_x86_64.rs4
-rw-r--r--src/librustc_trans/trans/debuginfo.rs4
-rw-r--r--src/librustc_trans/trans/meth.rs2
-rw-r--r--src/librustc_trans/trans/type_of.rs2
-rw-r--r--src/librustc_typeck/astconv.rs4
-rw-r--r--src/librustc_typeck/check/_match.rs2
-rw-r--r--src/librustc_typeck/check/mod.rs2
-rw-r--r--src/librustc_typeck/coherence/mod.rs2
-rw-r--r--src/librustc_typeck/collect.rs4
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/librustdoc/html/format.rs4
-rw-r--r--src/librustdoc/html/layout.rs6
-rw-r--r--src/librustdoc/html/markdown.rs4
-rw-r--r--src/librustdoc/html/render.rs12
-rw-r--r--src/librustdoc/lib.rs2
-rw-r--r--src/librustdoc/markdown.rs2
-rw-r--r--src/librustdoc/passes.rs4
-rw-r--r--src/librustdoc/test.rs2
-rw-r--r--src/librustdoc/visit_ast.rs2
-rw-r--r--src/libserialize/json.rs2
-rw-r--r--src/libstd/collections/hash/set.rs2
-rw-r--r--src/libstd/sys/windows/process2.rs2
-rw-r--r--src/libsyntax/codemap.rs2
-rw-r--r--src/libsyntax/ext/deriving/generic/mod.rs2
-rw-r--r--src/libsyntax/ext/env.rs2
-rw-r--r--src/libsyntax/ext/expand.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs2
-rw-r--r--src/libsyntax/parse/parser.rs14
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/libterm/terminfo/searcher.rs2
-rw-r--r--src/libunicode/u_str.rs4
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs2
-rw-r--r--src/test/bench/shootout-nbody.rs2
-rw-r--r--src/test/run-pass/dst-struct-sole.rs4
-rw-r--r--src/test/run-pass/dst-struct.rs4
67 files changed, 117 insertions, 117 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 55f15867532..8ae36393182 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -864,7 +864,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
                 }
                 first = false;
             }
-            if !failed && rest.len() == 0 {
+            if !failed && rest.is_empty() {
                 i += 1;
             }
             if i == num_check_lines {
@@ -1662,7 +1662,7 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
 // codegen tests (vs. clang)
 
 fn append_suffix_to_stem(p: &Path, suffix: &str) -> PathBuf {
-    if suffix.len() == 0 {
+    if suffix.is_empty() {
         p.to_path_buf()
     } else {
         let mut stem = p.file_stem().unwrap().to_os_string();
diff --git a/src/doc/reference.md b/src/doc/reference.md
index cc90a69fd2a..0ed23dae9b5 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -3788,7 +3788,7 @@ its type parameters are types:
 
 ```ignore
 fn map<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> Vec<B> {
-    if xs.len() == 0 {
+    if xs.is_empty() {
        return vec![];
     }
     let first: B = f(xs[0].clone());
diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs
index 413100039a2..859d5ea99bf 100644
--- a/src/libcollections/btree/map.rs
+++ b/src/libcollections/btree/map.rs
@@ -692,7 +692,7 @@ mod stack {
                         // We've reached the root, so no matter what, we're done. We manually
                         // access the root via the tree itself to avoid creating any dangling
                         // pointers.
-                        if self.map.root.len() == 0 && !self.map.root.is_leaf() {
+                        if self.map.root.is_empty() && !self.map.root.is_leaf() {
                             // We've emptied out the root, so make its only child the new root.
                             // If it's a leaf, we just let it become empty.
                             self.map.depth -= 1;
diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs
index 26c57256049..7f269c423f1 100644
--- a/src/libcollections/btree/node.rs
+++ b/src/libcollections/btree/node.rs
@@ -1097,7 +1097,7 @@ impl<K, V> Node<K, V> {
     /// When a node has no keys or values and only a single edge, extract that edge.
     pub fn hoist_lone_child(&mut self) {
         // Necessary for correctness, but in a private module
-        debug_assert!(self.len() == 0);
+        debug_assert!(self.is_empty());
         debug_assert!(!self.is_leaf());
 
         unsafe {
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 0e6acf0160d..4b1742a4348 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -204,7 +204,7 @@ impl<T> SliceExt for [T] {
 
     #[inline]
     fn first(&self) -> Option<&T> {
-        if self.len() == 0 { None } else { Some(&self[0]) }
+        if self.is_empty() { None } else { Some(&self[0]) }
     }
 
     #[inline]
@@ -217,7 +217,7 @@ impl<T> SliceExt for [T] {
 
     #[inline]
     fn last(&self) -> Option<&T> {
-        if self.len() == 0 { None } else { Some(&self[self.len() - 1]) }
+        if self.is_empty() { None } else { Some(&self[self.len() - 1]) }
     }
 
     #[inline]
@@ -296,7 +296,7 @@ impl<T> SliceExt for [T] {
 
     #[inline]
     fn first_mut(&mut self) -> Option<&mut T> {
-        if self.len() == 0 { None } else { Some(&mut self[0]) }
+        if self.is_empty() { None } else { Some(&mut self[0]) }
     }
 
     #[inline]
@@ -1306,7 +1306,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
 
     #[inline]
     fn next(&mut self) -> Option<&'a [T]> {
-        if self.v.len() == 0 {
+        if self.v.is_empty() {
             None
         } else {
             let chunksz = cmp::min(self.v.len(), self.size);
@@ -1318,7 +1318,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
 
     #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) {
-        if self.v.len() == 0 {
+        if self.v.is_empty() {
             (0, Some(0))
         } else {
             let n = self.v.len() / self.size;
@@ -1333,7 +1333,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
 impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
     #[inline]
     fn next_back(&mut self) -> Option<&'a [T]> {
-        if self.v.len() == 0 {
+        if self.v.is_empty() {
             None
         } else {
             let remainder = self.v.len() % self.size;
@@ -1384,7 +1384,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
 
     #[inline]
     fn next(&mut self) -> Option<&'a mut [T]> {
-        if self.v.len() == 0 {
+        if self.v.is_empty() {
             None
         } else {
             let sz = cmp::min(self.v.len(), self.chunk_size);
@@ -1397,7 +1397,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
 
     #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) {
-        if self.v.len() == 0 {
+        if self.v.is_empty() {
             (0, Some(0))
         } else {
             let n = self.v.len() / self.chunk_size;
@@ -1412,7 +1412,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
 impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> {
     #[inline]
     fn next_back(&mut self) -> Option<&'a mut [T]> {
-        if self.v.len() == 0 {
+        if self.v.is_empty() {
             None
         } else {
             let remainder = self.v.len() % self.chunk_size;
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index fc623f21167..2d6ef39361e 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -1119,7 +1119,7 @@ enum OldSearcher {
 impl OldSearcher {
     #[allow(dead_code)]
     fn new(haystack: &[u8], needle: &[u8]) -> OldSearcher {
-        if needle.len() == 0 {
+        if needle.is_empty() {
             // Handle specially
             unimplemented!()
         // FIXME: Tune this.
diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs
index 62b693dcbe6..9a96612195c 100644
--- a/src/libcore/str/pattern.rs
+++ b/src/libcore/str/pattern.rs
@@ -457,7 +457,7 @@ fn str_search_step<F, G>(mut m: &mut StrSearcher,
 {
     if m.state.done() {
         SearchStep::Done
-    } else if m.needle.len() == 0 && m.start <= m.end {
+    } else if m.needle.is_empty() && m.start <= m.end {
         // Case for needle == ""
         if let State::Reject(a, b) = m.state.take() {
             SearchStep::Reject(a, b)
diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs
index 46b9b2ed865..9ea680c7efe 100644
--- a/src/liblog/directive.rs
+++ b/src/liblog/directive.rs
@@ -45,7 +45,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
         return (dirs, None);
     }
     mods.map(|m| { for s in m.split(',') {
-        if s.len() == 0 { continue }
+        if s.is_empty() { continue }
         let mut parts = s.split('=');
         let (log_level, name) = match (parts.next(), parts.next().map(|s| s.trim()), parts.next()) {
             (Some(part0), None, None) => {
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index a2028c5ae72..802c5815398 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -80,7 +80,7 @@ pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
             (None, Some(sess)) => sess.err(s),
         }
     };
-    if s.len() == 0 {
+    if s.is_empty() {
         say("crate name must not be empty");
     }
     for c in s.chars() {
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index a659a93aef3..6b3bde409f5 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -767,7 +767,7 @@ pub fn get_enum_variants<'tcx>(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::Nod
                         get_type(cdata, field_ty.id.node, tcx).ty
                     })
                     .collect();
-                let arg_names = if arg_names.len() == 0 { None } else { Some(arg_names) };
+                let arg_names = if arg_names.is_empty() { None } else { Some(arg_names) };
 
                 (None, arg_tys, arg_names)
             }
@@ -1383,7 +1383,7 @@ pub fn get_dylib_dependency_formats(cdata: Cmd)
 
     debug!("found dylib deps: {}", formats.as_str_slice());
     for spec in formats.as_str_slice().split(',') {
-        if spec.len() == 0 { continue }
+        if spec.is_empty() { continue }
         let cnum = spec.split(':').nth(0).unwrap();
         let link = spec.split(':').nth(1).unwrap();
         let cnum: ast::CrateNum = cnum.parse().unwrap();
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index f9d3d707bb5..50ad8526e8c 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1751,7 +1751,7 @@ fn encode_codemap(ecx: &EncodeContext, rbml_w: &mut Encoder) {
 
     for filemap in &codemap.files.borrow()[..] {
 
-        if filemap.lines.borrow().len() == 0 || filemap.is_imported() {
+        if filemap.lines.borrow().is_empty() || filemap.is_imported() {
             // No need to export empty filemaps, as they can't contain spans
             // that need translation.
             // Also no need to re-export imported filemaps, as any downstream
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 7b63e38b585..97b1dae7223 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -517,7 +517,7 @@ impl<'a> Context<'a> {
             //                library's metadata sections. In theory we should
             //                read both, but reading dylib metadata is quite
             //                slow.
-            if m.len() == 0 {
+            if m.is_empty() {
                 return None
             } else if m.len() == 1 {
                 return Some(m.into_iter().next().unwrap())
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index 14df040fb79..912854a6d7d 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -239,7 +239,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
                     if let Some(DefLocal(_)) = def {
                         if ty::enum_variants(cx.tcx, def_id).iter().any(|variant|
                             token::get_name(variant.name) == token::get_name(ident.node.name)
-                                && variant.args.len() == 0
+                                && variant.args.is_empty()
                         ) {
                             span_warn!(cx.tcx.sess, p.span, E0170,
                                 "pattern binding `{}` is named the same as one \
@@ -636,19 +636,19 @@ fn is_useful(cx: &MatchCheckCtxt,
              -> Usefulness {
     let &Matrix(ref rows) = matrix;
     debug!("{:?}", matrix);
-    if rows.len() == 0 {
+    if rows.is_empty() {
         return match witness {
             ConstructWitness => UsefulWithWitness(vec!()),
             LeaveOutWitness => Useful
         };
     }
-    if rows[0].len() == 0 {
+    if rows[0].is_empty() {
         return NotUseful;
     }
     assert!(rows.iter().all(|r| r.len() == v.len()));
     let real_pat = match rows.iter().find(|r| (*r)[0].id != DUMMY_NODE_ID) {
         Some(r) => raw_pat(r[0]),
-        None if v.len() == 0 => return NotUseful,
+        None if v.is_empty() => return NotUseful,
         None => v[0]
     };
     let left_ty = if real_pat.id == DUMMY_NODE_ID {
diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs
index 03e76f5ee25..89af7f072d7 100644
--- a/src/librustc/middle/infer/error_reporting.rs
+++ b/src/librustc/middle/infer/error_reporting.rs
@@ -1241,7 +1241,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
                             let lifetimes =
                                 path.segments.last().unwrap().parameters.lifetimes();
                             let mut insert = Vec::new();
-                            if lifetimes.len() == 0 {
+                            if lifetimes.is_empty() {
                                 let anon = self.cur_anon.get();
                                 for (i, a) in (anon..anon+expected).enumerate() {
                                     if anon_nums.contains(&a) {
@@ -1361,7 +1361,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
 
             ast::AngleBracketedParameters(ref data) => {
                 let mut new_lts = Vec::new();
-                if data.lifetimes.len() == 0 {
+                if data.lifetimes.is_empty() {
                     // traverse once to see if there's a need to insert lifetime
                     let need_insert = (0..expected).any(|i| {
                         indexes.contains(&i)
diff --git a/src/librustc/middle/infer/region_inference/graphviz.rs b/src/librustc/middle/infer/region_inference/graphviz.rs
index 1fcbf80c904..054cec68745 100644
--- a/src/librustc/middle/infer/region_inference/graphviz.rs
+++ b/src/librustc/middle/infer/region_inference/graphviz.rs
@@ -88,7 +88,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a,
             Err(_) => "/tmp/constraints.node%.dot".to_string(),
         };
 
-        if output_template.len() == 0 {
+        if output_template.is_empty() {
             tcx.sess.bug("empty string provided as RUST_REGION_GRAPH");
         }
 
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 786cd902c53..8d9ddfb3d5d 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -716,7 +716,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
             None => {
                 // Vanilla 'break' or 'loop', so use the enclosing
                 // loop scope
-                if self.loop_scope.len() == 0 {
+                if self.loop_scope.is_empty() {
                     self.ir.tcx.sess.span_bug(sp, "break outside loop");
                 } else {
                     *self.loop_scope.last().unwrap()
@@ -1586,7 +1586,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
 
     fn should_warn(&self, var: Variable) -> Option<String> {
         let name = self.ir.variable_name(var);
-        if name.len() == 0 || name.as_bytes()[0] == ('_' as u8) {
+        if name.is_empty() || name.as_bytes()[0] == ('_' as u8) {
             None
         } else {
             Some(name)
diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs
index e2ebe2bc0f1..d9cdf0fa1cb 100644
--- a/src/librustc/middle/subst.rs
+++ b/src/librustc/middle/subst.rs
@@ -361,7 +361,7 @@ impl<T> VecPerParamSpace<T> {
     pub fn get_self<'a>(&'a self) -> Option<&'a T> {
         let v = self.get_slice(SelfSpace);
         assert!(v.len() <= 1);
-        if v.len() == 0 { None } else { Some(&v[0]) }
+        if v.is_empty() { None } else { Some(&v[0]) }
     }
 
     pub fn len(&self, space: ParamSpace) -> usize {
diff --git a/src/librustc/middle/traits/fulfill.rs b/src/librustc/middle/traits/fulfill.rs
index ffd3299175d..5938c6df92a 100644
--- a/src/librustc/middle/traits/fulfill.rs
+++ b/src/librustc/middle/traits/fulfill.rs
@@ -298,7 +298,7 @@ impl<'tcx> FulfillmentContext<'tcx> {
                self.predicates.len(),
                errors.len());
 
-        if errors.len() == 0 {
+        if errors.is_empty() {
             Ok(())
         } else {
             Err(errors)
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index 08357084bb2..ed8a6fb0200 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -698,7 +698,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         // is checked for in `evaluate_stack` (and hence users
         // who might care about this case, like coherence, should use
         // that function).
-        if candidates.len() == 0 {
+        if candidates.is_empty() {
             return Err(Unimplemented);
         }
 
@@ -873,7 +873,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         try!(self.assemble_candidates_from_caller_bounds(stack, &mut candidates));
         // Default implementations have lower priority, so we only
         // consider triggering a default if there is no other impl that can apply.
-        if candidates.vec.len() == 0 {
+        if candidates.vec.is_empty() {
             try!(self.assemble_candidates_from_default_impls(obligation, &mut candidates));
         }
         debug!("candidate list size: {}", candidates.vec.len());
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index be126b0b54c..b5b148e491b 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -3036,7 +3036,7 @@ pub fn mk_trait<'tcx>(cx: &ctxt<'tcx>,
 }
 
 fn bound_list_is_sorted(bounds: &[ty::PolyProjectionPredicate]) -> bool {
-    bounds.len() == 0 ||
+    bounds.is_empty() ||
         bounds[1..].iter().enumerate().all(
             |(index, bound)| bounds[index].sort_key() <= bound.sort_key())
 }
@@ -3687,7 +3687,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
                             if variants.len() == 2 {
                                 let mut data_idx = 0;
 
-                                if variants[0].args.len() == 0 {
+                                if variants[0].args.is_empty() {
                                     data_idx = 1;
                                 }
 
@@ -4200,10 +4200,10 @@ pub fn type_is_c_like_enum(cx: &ctxt, ty: Ty) -> bool {
     match ty.sty {
         ty_enum(did, _) => {
             let variants = enum_variants(cx, did);
-            if variants.len() == 0 {
+            if variants.is_empty() {
                 false
             } else {
-                variants.iter().all(|v| v.args.len() == 0)
+                variants.iter().all(|v| v.args.is_empty())
             }
         }
         _ => false
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index a7d608d2c87..3fb6c191f6c 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -902,7 +902,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
     };
     output_types.sort();
     output_types.dedup();
-    if output_types.len() == 0 {
+    if output_types.is_empty() {
         output_types.push(OutputTypeExe);
     }
 
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 7358b4cc0f6..e6f1c76b2e4 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -1269,7 +1269,7 @@ impl<'tcx, T> UserString<'tcx> for ty::Binder<T>
         let names: Vec<_> = names.iter().map(|s| &s[..]).collect();
 
         let value_str = unbound_value.user_string(tcx);
-        if names.len() == 0 {
+        if names.is_empty() {
             value_str
         } else {
             format!("for<{}> {}", names.connect(","), value_str)
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index e310798b20a..1453c9b784b 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -887,9 +887,9 @@ pub fn collect_crate_types(session: &Session,
     // command line, then reuse the empty `base` Vec to hold the types that
     // will be found in crate attributes.
     let mut base = session.opts.crate_types.clone();
-    if base.len() == 0 {
+    if base.is_empty() {
         base.extend(attr_types.into_iter());
-        if base.len() == 0 {
+        if base.is_empty() {
             base.push(link::default_output_for_target(session));
         }
         base.sort();
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 89c19cfb0b0..8f21a800d5c 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -425,7 +425,7 @@ impl RustcDefaultCalls {
                         odir: &Option<PathBuf>,
                         ofile: &Option<PathBuf>)
                         -> Compilation {
-        if sess.opts.prints.len() == 0 {
+        if sess.opts.prints.is_empty() {
             return Compilation::Continue;
         }
 
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs
index 410f31e0900..00c3450ebb9 100644
--- a/src/librustc_driver/pretty.rs
+++ b/src/librustc_driver/pretty.rs
@@ -676,7 +676,7 @@ fn print_flowgraph<W: Write>(variants: Vec<borrowck_dot::Variant>,
     };
 
     match code {
-        _ if variants.len() == 0 => {
+        _ if variants.is_empty() => {
             let r = dot::render(&lcfg, &mut out);
             return expand_err_details(r);
         }
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index 52db6013f4d..777154f3c9c 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -767,7 +767,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
                 f.name
             }).collect::<Vec<_>>();
 
-            if fields.len() == 0 {
+            if fields.is_empty() {
                 child_name_bindings.define_value(def, DUMMY_SP, modifiers);
             }
 
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 6fd59a20532..1b6af605fb0 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -2172,7 +2172,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     // check that all of the arms in an or-pattern have exactly the
     // same set of bindings, with the same binding modes for each.
     fn check_consistent_bindings(&mut self, arm: &Arm) {
-        if arm.pats.len() == 0 {
+        if arm.pats.is_empty() {
             return
         }
         let map_0 = self.binding_mode_map(&*arm.pats[0]);
@@ -3522,7 +3522,7 @@ fn module_to_string(module: &Module) -> String {
     }
     collect_mod(&mut names, module);
 
-    if names.len() == 0 {
+    if names.is_empty() {
         return "???".to_string();
     }
     names_to_string(&names.into_iter().rev().collect::<Vec<ast::Name>>())
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
index f1a8507b178..4b488981bfb 100644
--- a/src/librustc_resolve/resolve_imports.rs
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -304,7 +304,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
                module_to_string(&*module_));
 
         // First, resolve the module path for the directive, if necessary.
-        let container = if module_path.len() == 0 {
+        let container = if module_path.is_empty() {
             // Use the crate root.
             Some((self.resolver.graph_root.get_module(), LastMod(AllPublic)))
         } else {
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index ad777351898..33fadf804f5 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -463,7 +463,7 @@ pub fn filename_for_input(sess: &Session,
         }
         config::CrateTypeExecutable => {
             let suffix = &sess.target.target.options.exe_suffix;
-            if suffix.len() == 0 {
+            if suffix.is_empty() {
                 out_filename.to_path_buf()
             } else {
                 out_filename.with_extension(&suffix[1..])
diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs
index 1a19d4a1e45..21c95f4ce4a 100644
--- a/src/librustc_trans/save/mod.rs
+++ b/src/librustc_trans/save/mod.rs
@@ -263,7 +263,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
 
     fn process_formals(&mut self, formals: &Vec<ast::Arg>, qualname: &str) {
         for arg in formals {
-            assert!(self.collected_paths.len() == 0 && !self.collecting);
+            assert!(self.collected_paths.is_empty() && !self.collecting);
             self.collecting = true;
             self.visit_pat(&*arg.pat);
             self.collecting = false;
@@ -1394,7 +1394,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
     }
 
     fn visit_arm(&mut self, arm: &ast::Arm) {
-        assert!(self.collected_paths.len() == 0 && !self.collecting);
+        assert!(self.collected_paths.is_empty() && !self.collecting);
         self.collecting = true;
         for pattern in &arm.pats {
             // collect paths from the arm's patterns
@@ -1462,7 +1462,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
 
         // The local could declare multiple new vars, we must walk the
         // pattern and collect them all.
-        assert!(self.collected_paths.len() == 0 && !self.collecting);
+        assert!(self.collected_paths.is_empty() && !self.collecting);
         self.collecting = true;
         self.visit_pat(&*l.pat);
         self.collecting = false;
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index 390a9cc4d26..54afeca13ed 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -988,7 +988,7 @@ fn compile_submatch<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let _indenter = indenter();
     let _icx = push_ctxt("match::compile_submatch");
     let mut bcx = bcx;
-    if m.len() == 0 {
+    if m.is_empty() {
         if chk.is_fallible() {
             chk.handle_fail(bcx);
         }
@@ -1152,7 +1152,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
     };
 
     let defaults = enter_default(else_cx, dm, m, col, val);
-    let exhaustive = chk.is_infallible() && defaults.len() == 0;
+    let exhaustive = chk.is_infallible() && defaults.is_empty();
     let len = opts.len();
 
     // Compile subtrees for each option
diff --git a/src/librustc_trans/trans/adt.rs b/src/librustc_trans/trans/adt.rs
index fd1fff308df..f574b4ed8db 100644
--- a/src/librustc_trans/trans/adt.rs
+++ b/src/librustc_trans/trans/adt.rs
@@ -235,7 +235,7 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
             let dtor = ty::ty_dtor(cx.tcx(), def_id).has_drop_flag();
 
-            if cases.len() == 0 {
+            if cases.is_empty() {
                 // Uninhabitable; represent as unit
                 // (Typechecking will reject discriminant-sizing attrs.)
                 assert_eq!(hint, attr::ReprAny);
@@ -244,7 +244,7 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                   dtor_to_init_u8(dtor));
             }
 
-            if !dtor && cases.iter().all(|c| c.tys.len() == 0) {
+            if !dtor && cases.iter().all(|c| c.tys.is_empty()) {
                 // All bodies empty -> intlike
                 let discrs: Vec<u64> = cases.iter().map(|c| c.discr).collect();
                 let bounds = IntBounds {
diff --git a/src/librustc_trans/trans/cabi_x86_64.rs b/src/librustc_trans/trans/cabi_x86_64.rs
index 754b7ee5cf5..8d946e2743b 100644
--- a/src/librustc_trans/trans/cabi_x86_64.rs
+++ b/src/librustc_trans/trans/cabi_x86_64.rs
@@ -70,7 +70,7 @@ trait ClassList {
 
 impl ClassList for [RegClass] {
     fn is_pass_byval(&self) -> bool {
-        if self.len() == 0 { return false; }
+        if self.is_empty() { return false; }
 
         let class = self[0];
            class == Memory
@@ -79,7 +79,7 @@ impl ClassList for [RegClass] {
     }
 
     fn is_ret_bysret(&self) -> bool {
-        if self.len() == 0 { return false; }
+        if self.is_empty() { return false; }
 
         self[0] == Memory
     }
diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs
index 3e6e6b49985..40cbb909fc1 100644
--- a/src/librustc_trans/trans/debuginfo.rs
+++ b/src/librustc_trans/trans/debuginfo.rs
@@ -2017,7 +2017,7 @@ struct StructMemberDescriptionFactory<'tcx> {
 impl<'tcx> StructMemberDescriptionFactory<'tcx> {
     fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
-        if self.fields.len() == 0 {
+        if self.fields.is_empty() {
             return Vec::new();
         }
 
@@ -2210,7 +2210,7 @@ impl<'tcx> EnumMemberDescriptionFactory<'tcx> {
             adt::Univariant(ref struct_def, _) => {
                 assert!(self.variants.len() <= 1);
 
-                if self.variants.len() == 0 {
+                if self.variants.is_empty() {
                     vec![]
                 } else {
                     let (variant_type_metadata,
diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs
index e2f965a95ff..e346fb0d931 100644
--- a/src/librustc_trans/trans/meth.rs
+++ b/src/librustc_trans/trans/meth.rs
@@ -83,7 +83,7 @@ pub fn trans_impl(ccx: &CrateContext,
     for impl_item in impl_items {
         match impl_item.node {
             ast::MethodImplItem(ref sig, ref body) => {
-                if sig.generics.ty_params.len() == 0 {
+                if sig.generics.ty_params.is_empty() {
                     let trans_everywhere = attr::requests_inline(&impl_item.attrs);
                     for (ref ccx, is_origin) in ccx.maybe_iter(trans_everywhere) {
                         let llfn = get_item_val(ccx, impl_item.id);
diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs
index 8257dab20fa..b3ab58e416f 100644
--- a/src/librustc_trans/trans/type_of.rs
+++ b/src/librustc_trans/trans/type_of.rs
@@ -69,7 +69,7 @@ pub fn untuple_arguments_if_necessary<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         return inputs.iter().cloned().collect()
     }
 
-    if inputs.len() == 0 {
+    if inputs.is_empty() {
         return Vec::new()
     }
 
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index ff22127fdc6..6d4b660f30d 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1125,7 +1125,7 @@ fn one_bound_for_assoc_type<'tcx>(tcx: &ty::ctxt<'tcx>,
                                   span: Span)
     -> Result<ty::PolyTraitRef<'tcx>, ErrorReported>
 {
-    if bounds.len() == 0 {
+    if bounds.is_empty() {
         span_err!(tcx.sess, span, E0220,
                   "associated type `{}` not found for `{}`",
                   assoc_name,
@@ -2042,7 +2042,7 @@ fn compute_object_lifetime_bound<'tcx>(
 
     // If there are no derived region bounds, then report back that we
     // can find no region bound.
-    if derived_region_bounds.len() == 0 {
+    if derived_region_bounds.is_empty() {
         match rscope.object_lifetime_default(span) {
             Some(r) => { return r; }
             None => {
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 8f1a67723cb..0959f9d1b91 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -594,7 +594,7 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             for (subpat, arg_ty) in subpats.iter().zip(arg_tys.iter()) {
                 check_pat(pcx, &**subpat, *arg_ty);
             }
-        } else if arg_tys.len() == 0 {
+        } else if arg_tys.is_empty() {
             span_err!(tcx.sess, pat.span, E0024,
                       "this pattern has {} field{}, but the corresponding {} has no fields",
                       subpats.len(), if subpats.len() == 1 {""} else {"s"}, kind_name);
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 8264647b256..ded9b86e235 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4719,7 +4719,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
            tps.len(), ppaux::ty_to_string(ccx.tcx, ty));
 
     // make a vector of booleans initially false, set to true when used
-    if tps.len() == 0 { return; }
+    if tps.is_empty() { return; }
     let mut tps_used: Vec<_> = repeat(false).take(tps.len()).collect();
 
     ty::walk_ty(ty, |t| {
diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs
index 51d0c18872d..b0c994f7f64 100644
--- a/src/librustc_typeck/coherence/mod.rs
+++ b/src/librustc_typeck/coherence/mod.rs
@@ -387,7 +387,7 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
 
         for &impl_did in &*trait_impls.borrow() {
             let items = impl_items.get(&impl_did).unwrap();
-            if items.len() < 1 {
+            if items.is_empty() {
                 // We'll error out later. For now, just don't ICE.
                 continue;
             }
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 95b943b2547..aa405225366 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -1035,7 +1035,7 @@ fn convert_struct<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     match struct_def.ctor_id {
         None => {}
         Some(ctor_id) => {
-            if struct_def.fields.len() == 0 {
+            if struct_def.fields.is_empty() {
                 // Enum-like.
                 write_ty_to_tcx(tcx, ctor_id, selfty);
 
@@ -1893,7 +1893,7 @@ fn compute_object_lifetime_default<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
                   .flat_map(|predicate| {
                       match *predicate {
                           ast::WherePredicate::BoundPredicate(ref data) => {
-                              if data.bound_lifetimes.len() == 0 &&
+                              if data.bound_lifetimes.is_empty() &&
                                   is_param(ccx.tcx, &data.bounded_ty, param_id)
                               {
                                   from_bounds(ccx, &data.bounds).into_iter()
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 38df0339e42..ff364eb69a8 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1820,7 +1820,7 @@ impl<'tcx> Clean<Item> for ty::VariantInfo<'tcx> {
     fn clean(&self, cx: &DocContext) -> Item {
         // use syntax::parse::token::special_idents::unnamed_field;
         let kind = match self.arg_names.as_ref().map(|s| &**s) {
-            None | Some([]) if self.args.len() == 0 => CLikeVariant,
+            None | Some([]) if self.args.is_empty() => CLikeVariant,
             None | Some([]) => {
                 TupleVariant(self.args.clean(cx))
             }
@@ -1874,7 +1874,7 @@ impl Clean<VariantKind> for ast::VariantKind {
     fn clean(&self, cx: &DocContext) -> VariantKind {
         match self {
             &ast::TupleVariantKind(ref args) => {
-                if args.len() == 0 {
+                if args.is_empty() {
                     CLikeVariant
                 } else {
                     TupleVariant(args.iter().map(|x| x.ty.clean(cx)).collect())
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index f6215dcb00c..5aded0215e9 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -94,7 +94,7 @@ impl<'a> fmt::Display for TyParamBounds<'a> {
 
 impl fmt::Display for clean::Generics {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        if self.lifetimes.len() == 0 && self.type_params.len() == 0 { return Ok(()) }
+        if self.lifetimes.is_empty() && self.type_params.is_empty() { return Ok(()) }
         try!(f.write_str("&lt;"));
 
         for (i, life) in self.lifetimes.iter().enumerate() {
@@ -132,7 +132,7 @@ impl fmt::Display for clean::Generics {
 impl<'a> fmt::Display for WhereClause<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let &WhereClause(gens) = self;
-        if gens.where_predicates.len() == 0 {
+        if gens.where_predicates.is_empty() {
             return Ok(());
         }
         try!(f.write_str(" <span class='where'>where "));
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 3acd17dedd5..a53884ca047 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -130,7 +130,7 @@ r##"<!DOCTYPE html>
     content   = *t,
     root_path = page.root_path,
     ty        = page.ty,
-    logo      = if layout.logo.len() == 0 {
+    logo      = if layout.logo.is_empty() {
         "".to_string()
     } else {
         format!("<a href='{}{}/index.html'>\
@@ -141,7 +141,7 @@ r##"<!DOCTYPE html>
     title     = page.title,
     description = page.description,
     keywords = page.keywords,
-    favicon   = if layout.favicon.len() == 0 {
+    favicon   = if layout.favicon.is_empty() {
         "".to_string()
     } else {
         format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
@@ -152,7 +152,7 @@ r##"<!DOCTYPE html>
     sidebar   = *sidebar,
     krate     = layout.krate,
     play_url  = layout.playground_url,
-    play_js   = if layout.playground_url.len() == 0 {
+    play_js   = if layout.playground_url.is_empty() {
         "".to_string()
     } else {
         format!(r#"<script src="{}playpen.js"></script>"#, page.root_path)
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index cb80d071ce4..334f05fb36f 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -305,7 +305,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
         let text = format!(r##"<h{lvl} id="{id}" class='section-header'><a
                            href="#{id}">{sec}{}</a></h{lvl}>"##,
                            s, lvl = level, id = id,
-                           sec = if sec.len() == 0 {
+                           sec = if sec.is_empty() {
                                sec.to_string()
                            } else {
                                format!("{} ", sec)
@@ -491,7 +491,7 @@ impl<'a> fmt::Display for Markdown<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let Markdown(md) = *self;
         // This is actually common enough to special-case
-        if md.len() == 0 { return Ok(()) }
+        if md.is_empty() { return Ok(()) }
         render(fmt, md, false)
     }
 }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 8e33a9bd80b..5ee78bf836e 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -912,7 +912,7 @@ impl DocFolder for Cache {
                      false)
                 }
                 clean::MethodItem(..) => {
-                    if self.parent_stack.len() == 0 {
+                    if self.parent_stack.is_empty() {
                         ((None, None), false)
                     } else {
                         let last = self.parent_stack.last().unwrap();
@@ -1115,7 +1115,7 @@ impl Context {
     fn recurse<T, F>(&mut self, s: String, f: F) -> T where
         F: FnOnce(&mut Context) -> T,
     {
-        if s.len() == 0 {
+        if s.is_empty() {
             panic!("Unexpected empty destination: {:?}", self.current);
         }
         let prev = self.dst.clone();
@@ -1343,7 +1343,7 @@ impl Context {
     fn ignore_private_item(&self, it: &clean::Item) -> bool {
         match it.inner {
             clean::ModuleItem(ref m) => {
-                (m.items.len() == 0 &&
+                (m.items.is_empty() &&
                  it.doc_value().is_none() &&
                  it.visibility != Some(ast::Public)) ||
                 (self.passes.contains("strip-private") && it.visibility != Some(ast::Public))
@@ -1690,7 +1690,7 @@ struct Initializer<'a>(&'a str);
 impl<'a> fmt::Display for Initializer<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let Initializer(s) = *self;
-        if s.len() == 0 { return Ok(()); }
+        if s.is_empty() { return Ok(()); }
         try!(write!(f, "<code> = </code>"));
         write!(f, "<code>{}</code>", s)
     }
@@ -1766,7 +1766,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
         match m.inner { clean::MethodItem(_) => true, _ => false }
     }).collect::<Vec<_>>();
 
-    if t.items.len() == 0 {
+    if t.items.is_empty() {
         try!(write!(w, "{{ }}"));
     } else {
         try!(write!(w, "{{\n"));
@@ -1986,7 +1986,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
                   it.name.as_ref().unwrap(),
                   e.generics,
                   WhereClause(&e.generics)));
-    if e.variants.len() == 0 && !e.variants_stripped {
+    if e.variants.is_empty() && !e.variants_stripped {
         try!(write!(w, " {{}}"));
     } else {
         try!(write!(w, " {{\n"));
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 1393c39f66c..008da466db0 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -219,7 +219,7 @@ pub fn main_args(args: &[String]) -> isize {
         return 0;
     }
 
-    if matches.free.len() == 0 {
+    if matches.free.is_empty() {
         println!("expected an input file to act on");
         return 1;
     } if matches.free.len() > 1 {
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs
index 6541564d8e2..00de4e3ec53 100644
--- a/src/librustdoc/markdown.rs
+++ b/src/librustdoc/markdown.rs
@@ -74,7 +74,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
     };
 
     let (metadata, text) = extract_leading_metadata(&input_str);
-    if metadata.len() == 0 {
+    if metadata.is_empty() {
         let _ = writeln!(&mut io::stderr(),
                          "invalid markdown file: expecting initial line with `% ...TITLE...`");
         return 5;
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index 953b442bb3c..7b8241e9b5b 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -215,9 +215,9 @@ impl<'a> fold::DocFolder for Stripper<'a> {
                 match i.inner {
                     // emptied modules/impls have no need to exist
                     clean::ModuleItem(ref m)
-                        if m.items.len() == 0 &&
+                        if m.items.is_empty() &&
                            i.doc_value().is_none() => None,
-                    clean::ImplItem(ref i) if i.items.len() == 0 => None,
+                    clean::ImplItem(ref i) if i.items.is_empty() => None,
                     _ => {
                         self.retained.insert(i.def_id.node);
                         Some(i)
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 94b521a89cf..449f9c79d1d 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -409,7 +409,7 @@ impl Collector {
 impl DocFolder for Collector {
     fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
         let pushed = match item.name {
-            Some(ref name) if name.len() == 0 => false,
+            Some(ref name) if name.is_empty() => false,
             Some(ref name) => { self.names.push(name.to_string()); true }
             None => false
         };
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index a1fa96322a4..e4f4dbaafbe 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -175,7 +175,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
                                      please_inline)
                 }).collect::<Vec<ast::PathListItem>>();
 
-                if mine.len() == 0 {
+                if mine.is_empty() {
                     None
                 } else {
                     Some(ast::ViewPathList(p, mine))
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 620ea40b48a..8f020d0857d 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -3837,7 +3837,7 @@ mod tests {
         let mut stack = Stack::new();
 
         assert!(stack.is_empty());
-        assert!(stack.len() == 0);
+        assert!(stack.is_empty());
         assert!(!stack.last_is_index());
 
         stack.push_index(0);
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index 6b0546b1ee7..62c03389b24 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -430,7 +430,7 @@ impl<T, S> HashSet<T, S>
     /// assert!(!v.is_empty());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn is_empty(&self) -> bool { self.map.len() == 0 }
+    pub fn is_empty(&self) -> bool { self.map.is_empty() }
 
     /// Clears the set, returning all elements in an iterator.
     #[inline]
diff --git a/src/libstd/sys/windows/process2.rs b/src/libstd/sys/windows/process2.rs
index 74953921921..3d5c9867a6f 100644
--- a/src/libstd/sys/windows/process2.rs
+++ b/src/libstd/sys/windows/process2.rs
@@ -381,7 +381,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> Vec<u16> {
         // it will be dropped entirely when parsed on the other end.
         let arg_bytes = &arg.as_inner().inner.as_inner();
         let quote = arg_bytes.iter().any(|c| *c == b' ' || *c == b'\t')
-            || arg_bytes.len() == 0;
+            || arg_bytes.is_empty();
         if quote {
             cmd.push('"' as u16);
         }
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 5bbf79d0477..f024a3139a6 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -652,7 +652,7 @@ impl CodeMap {
     }
 
     pub fn span_to_string(&self, sp: Span) -> String {
-        if self.files.borrow().len() == 0 && sp == DUMMY_SP {
+        if self.files.borrow().is_empty() && sp == DUMMY_SP {
             return "no-location".to_string();
         }
 
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index ac96375095e..dcfc6b675e3 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -1248,7 +1248,7 @@ impl<'a> MethodDef<'a> {
 
             match_arms.push(catch_all_match_arm);
 
-        } else if variants.len() == 0 {
+        } else if variants.is_empty() {
             // As an additional wrinkle, For a zero-variant enum A,
             // currently the compiler
             // will accept `fn (a: &Self) { match   *a   { } }`
diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs
index f72303985e7..2ca74644b3b 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -65,7 +65,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT
 pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                        -> Box<base::MacResult+'cx> {
     let mut exprs = match get_exprs_from_tts(cx, sp, tts) {
-        Some(ref exprs) if exprs.len() == 0 => {
+        Some(ref exprs) if exprs.is_empty() => {
             cx.span_err(sp, "env! takes 1 or 2 arguments");
             return DummyResult::expr(sp);
         }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index b65798b8a49..74ec219af15 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -841,7 +841,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
 fn expand_arm(arm: ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
     // expand pats... they might contain macro uses:
     let expanded_pats = arm.pats.move_map(|pat| fld.fold_pat(pat));
-    if expanded_pats.len() == 0 {
+    if expanded_pats.is_empty() {
         panic!("encountered match arm with 0 patterns");
     }
     // all of the pats must have the same set of bindings, so use the
@@ -1887,7 +1887,7 @@ mod test {
             let binding_name = mtwt::resolve(bindings[binding_idx]);
             let binding_marks = mtwt::marksof(bindings[binding_idx].ctxt, invalid_name);
             // shouldmatch can't name varrefs that don't exist:
-            assert!((shouldmatch.len() == 0) ||
+            assert!((shouldmatch.is_empty()) ||
                     (varrefs.len() > *shouldmatch.iter().max().unwrap()));
             for (idx,varref) in varrefs.iter().enumerate() {
                 let print_hygiene_debug_info = || {
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 4e0b74401a2..dcbf3c2c892 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -472,7 +472,7 @@ pub fn parse(sess: &ParseSess,
                     "local ambiguity: multiple parsing options: \
                      built-in NTs {} or {} other options.",
                     nts, next_eis.len()).to_string());
-            } else if bb_eis.len() == 0 && next_eis.len() == 0 {
+            } else if bb_eis.is_empty() && next_eis.is_empty() {
                 return Failure(sp, format!("no rules expected the token `{}`",
                             pprust::token_to_string(&tok)).to_string());
             } else if next_eis.len() > 0 {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e45b7c1df91..fe5fbdccf61 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -449,7 +449,7 @@ impl<'a> Parser<'a> {
                     (format!("expected one of {}, found `{}`",
                              expect,
                              actual))
-                } else if expected.len() == 0 {
+                } else if expected.is_empty() {
                     (format!("unexpected token: `{}`",
                              actual))
                 } else {
@@ -1244,7 +1244,7 @@ impl<'a> Parser<'a> {
 
         // In type grammar, `+` is treated like a binary operator,
         // and hence both L and R side are required.
-        if bounds.len() == 0 {
+        if bounds.is_empty() {
             let last_span = self.last_span;
             self.span_err(last_span,
                           "at least one type parameter bound \
@@ -2191,7 +2191,7 @@ impl<'a> Parser<'a> {
                                                  &[token::CloseDelim(token::Brace)]));
                             }
 
-                            if fields.len() == 0 && base.is_none() {
+                            if fields.is_empty() && base.is_none() {
                                 let last_span = self.last_span;
                                 self.span_err(last_span,
                                               "structure literal must either \
@@ -3914,7 +3914,7 @@ impl<'a> Parser<'a> {
                         let hi = self.span.hi;
                         let span = mk_sp(lo, hi);
 
-                        if bounds.len() == 0 {
+                        if bounds.is_empty() {
                             self.span_err(span,
                                           "each predicate in a `where` clause must have \
                                            at least one bound in it");
@@ -4572,7 +4572,7 @@ impl<'a> Parser<'a> {
                 fields.push(try!(self.parse_struct_decl_field(true)));
             }
 
-            if fields.len() == 0 {
+            if fields.is_empty() {
                 return Err(self.fatal(&format!("unit-like struct definition should be \
                     written as `struct {};`",
                     token::get_ident(class_name.clone()))));
@@ -4611,7 +4611,7 @@ impl<'a> Parser<'a> {
                     Ok(spanned(lo, p.span.hi, struct_field_))
                 }));
 
-            if fields.len() == 0 {
+            if fields.is_empty() {
                 return Err(self.fatal(&format!("unit-like struct definition should be \
                     written as `struct {};`",
                     token::get_ident(class_name.clone()))));
@@ -5023,7 +5023,7 @@ impl<'a> Parser<'a> {
                 all_nullary = false;
                 let start_span = self.span;
                 let struct_def = try!(self.parse_struct_def());
-                if struct_def.fields.len() == 0 {
+                if struct_def.fields.is_empty() {
                     self.span_err(start_span,
                         &format!("unit-like struct variant should be written \
                                  without braces, as `{},`",
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 3f883fb1172..0e9b471393b 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2546,7 +2546,7 @@ impl<'a> State<'a> {
 
     pub fn print_where_clause(&mut self, where_clause: &ast::WhereClause)
                               -> io::Result<()> {
-        if where_clause.predicates.len() == 0 {
+        if where_clause.predicates.is_empty() {
             return Ok(())
         }
 
diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs
index 3083f8e8929..16062060df0 100644
--- a/src/libterm/terminfo/searcher.rs
+++ b/src/libterm/terminfo/searcher.rs
@@ -20,7 +20,7 @@ use std::path::PathBuf;
 /// Return path to database entry for `term`
 #[allow(deprecated)]
 pub fn get_dbpath_for_term(term: &str) -> Option<Box<PathBuf>> {
-    if term.len() == 0 {
+    if term.is_empty() {
         return None;
     }
 
diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs
index 6852cfe11eb..701187ed35a 100644
--- a/src/libunicode/u_str.rs
+++ b/src/libunicode/u_str.rs
@@ -157,7 +157,7 @@ impl<'a> Iterator for Graphemes<'a> {
     #[inline]
     fn next(&mut self) -> Option<&'a str> {
         use tables::grapheme as gr;
-        if self.string.len() == 0 {
+        if self.string.is_empty() {
             return None;
         }
 
@@ -257,7 +257,7 @@ impl<'a> DoubleEndedIterator for Graphemes<'a> {
     #[inline]
     fn next_back(&mut self) -> Option<&'a str> {
         use tables::grapheme as gr;
-        if self.string.len() == 0 {
+        if self.string.is_empty() {
             return None;
         }
 
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index bcd8fbf8852..b777b25243b 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -184,7 +184,7 @@ fn main() {
    for line in rdr.lines() {
        let line = line.unwrap().trim().to_string();
 
-       if line.len() == 0 { continue; }
+       if line.is_empty() { continue; }
 
        match (line.as_bytes()[0] as char, proc_mode) {
 
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index 669a0e86f1e..de7fb737958 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -196,7 +196,7 @@ fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> {
     use std::mem;
     use std::raw::Repr;
 
-    if r.len() == 0 { return None }
+    if r.is_empty() { return None }
     unsafe {
         let mut raw = r.repr();
         let ret = raw.data as *mut T;
diff --git a/src/test/run-pass/dst-struct-sole.rs b/src/test/run-pass/dst-struct-sole.rs
index d440fb2a216..c5da5fc0c1a 100644
--- a/src/test/run-pass/dst-struct-sole.rs
+++ b/src/test/run-pass/dst-struct-sole.rs
@@ -79,7 +79,7 @@ pub fn main() {
 
     // Zero size vec.
     let f5: &Fat<[isize]> = &Fat { ptr: [] };
-    assert!(f5.ptr.len() == 0);
+    assert!(f5.ptr.is_empty());
     let f5: &Fat<[Bar]> = &Fat { ptr: [] };
-    assert!(f5.ptr.len() == 0);
+    assert!(f5.ptr.is_empty());
 }
diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs
index 8b6db23026b..92253d81595 100644
--- a/src/test/run-pass/dst-struct.rs
+++ b/src/test/run-pass/dst-struct.rs
@@ -98,9 +98,9 @@ pub fn main() {
 
     // Zero size vec.
     let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [] };
-    assert!(f5.ptr.len() == 0);
+    assert!(f5.ptr.is_empty());
     let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [] };
-    assert!(f5.ptr.len() == 0);
+    assert!(f5.ptr.is_empty());
 
     // Deeply nested.
     let f1 = Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} };