Cleanup return statements.

This commit is contained in:
Corey Farwell
2016-10-01 16:47:43 -04:00
parent 6d0894940f
commit a400cccd54
7 changed files with 16 additions and 17 deletions

View File

@@ -577,7 +577,7 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics)
_ => true, _ => true,
} }
}); });
return g; g
} }
/// Supertrait bounds for a trait are also listed in the generics coming from /// Supertrait bounds for a trait are also listed in the generics coming from

View File

@@ -764,7 +764,7 @@ impl Lifetime {
pub fn get_ref<'a>(&'a self) -> &'a str { pub fn get_ref<'a>(&'a self) -> &'a str {
let Lifetime(ref s) = *self; let Lifetime(ref s) = *self;
let s: &'a str = s; let s: &'a str = s;
return s; s
} }
pub fn statik() -> Lifetime { pub fn statik() -> Lifetime {
@@ -1129,7 +1129,7 @@ pub struct FnDecl {
impl FnDecl { impl FnDecl {
pub fn has_self(&self) -> bool { pub fn has_self(&self) -> bool {
return self.inputs.values.len() > 0 && self.inputs.values[0].name == "self"; self.inputs.values.len() > 0 && self.inputs.values[0].name == "self"
} }
pub fn self_type(&self) -> Option<SelfTy> { pub fn self_type(&self) -> Option<SelfTy> {

View File

@@ -141,7 +141,7 @@ pub fn ty_params(mut params: Vec<clean::TyParam>) -> Vec<clean::TyParam> {
for param in &mut params { for param in &mut params {
param.bounds = ty_bounds(mem::replace(&mut param.bounds, Vec::new())); param.bounds = ty_bounds(mem::replace(&mut param.bounds, Vec::new()));
} }
return params; params
} }
fn ty_bounds(bounds: Vec<clean::TyParamBound>) -> Vec<clean::TyParamBound> { fn ty_bounds(bounds: Vec<clean::TyParamBound>) -> Vec<clean::TyParamBound> {

View File

@@ -722,7 +722,7 @@ fn write_shared(cx: &Context,
ret.push(line.to_string()); ret.push(line.to_string());
} }
} }
return Ok(ret); Ok(ret)
} }
// Update the search index // Update the search index
@@ -1208,7 +1208,7 @@ impl DocFolder for Cache {
self.seen_mod = orig_seen_mod; self.seen_mod = orig_seen_mod;
self.stripped_mod = orig_stripped_mod; self.stripped_mod = orig_stripped_mod;
self.parent_is_trait_impl = orig_parent_is_trait_impl; self.parent_is_trait_impl = orig_parent_is_trait_impl;
return ret; ret
} }
} }
@@ -1249,7 +1249,7 @@ impl Context {
self.dst = prev; self.dst = prev;
self.current.pop().unwrap(); self.current.pop().unwrap();
return ret; ret
} }
/// Main method for rendering a crate. /// Main method for rendering a crate.
@@ -1450,7 +1450,7 @@ impl Context {
for (_, items) in &mut map { for (_, items) in &mut map {
items.sort(); items.sort();
} }
return map; map
} }
} }
@@ -1647,7 +1647,7 @@ fn full_path(cx: &Context, item: &clean::Item) -> String {
let mut s = cx.current.join("::"); let mut s = cx.current.join("::");
s.push_str("::"); s.push_str("::");
s.push_str(item.name.as_ref().unwrap()); s.push_str(item.name.as_ref().unwrap());
return s s
} }
fn shorter<'a>(s: Option<&'a str>) -> String { fn shorter<'a>(s: Option<&'a str>) -> String {

View File

@@ -288,15 +288,14 @@ pub fn main_args(args: &[String]) -> isize {
passes.into_iter().collect(), passes.into_iter().collect(),
css_file_extension, css_file_extension,
renderinfo) renderinfo)
.expect("failed to generate documentation") .expect("failed to generate documentation");
0
} }
Some(s) => { Some(s) => {
println!("unknown output format: {}", s); println!("unknown output format: {}", s);
return 1; 1
} }
} }
return 0;
} }
/// Looks inside the command line arguments to extract the relevant input format /// Looks inside the command line arguments to extract the relevant input format

View File

@@ -169,7 +169,7 @@ fn scrape_test_config(krate: &::rustc::hir::Crate) -> TestOptions {
} }
} }
return opts; opts
} }
fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths, fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
@@ -363,7 +363,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, dont_insert_main: bool,
info!("final test program: {}", prog); info!("final test program: {}", prog);
return prog prog
} }
fn partition_source(s: &str) -> (String, String) { fn partition_source(s: &str) -> (String, String) {
@@ -387,7 +387,7 @@ fn partition_source(s: &str) -> (String, String) {
} }
} }
return (before, after); (before, after)
} }
pub struct Collector { pub struct Collector {

View File

@@ -328,7 +328,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
_ => false, _ => false,
}; };
self.view_item_stack.remove(&def_node_id); self.view_item_stack.remove(&def_node_id);
return ret; ret
} }
pub fn visit_item(&mut self, item: &hir::Item, pub fn visit_item(&mut self, item: &hir::Item,