From bce30836adf3e19a41c1b58d3e15cf549944556c Mon Sep 17 00:00:00 2001 From: k-nasa Date: Fri, 11 Jan 2019 13:26:26 +0900 Subject: [PATCH 1/2] refactor: remove unnecessary `return` keyword --- src/cargo/ops/cargo_new.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 76473403be7..d16952bfa25 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -422,8 +422,8 @@ struct IgnoreList { impl IgnoreList { /// constructor to build a new ignore file fn new() -> IgnoreList { - return IgnoreList{ - ignore: Vec::new(), + IgnoreList { + ignore: Vec::new(), hg_ignore: Vec::new(), } } @@ -440,9 +440,9 @@ impl IgnoreList { /// version control system as `String`. fn format_new(&self, vcs: VersionControl) -> String { match vcs { - VersionControl::Hg => return self.hg_ignore.join("\n"), - _ => return self.ignore.join("\n"), - }; + VersionControl::Hg => self.hg_ignore.join("\n"), + _ => self.ignore.join("\n"), + } } /// format_existing is used to format the IgnoreList when the ignore file @@ -501,7 +501,7 @@ fn write_ignore_file(base_path: &Path, list: &IgnoreList, vcs: VersionControl) - paths::append(&fp_ignore, ignore.as_bytes())?; - return Ok(ignore) + Ok(ignore) } /// initialize the correct vcs system based on the provided config From 3aaeee5a9c0e9365451516f1b80198732fff3924 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Fri, 11 Jan 2019 13:35:28 +0900 Subject: [PATCH 2/2] refactor: Delete unnecessary name assignment --- src/cargo/core/manifest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index c28e74a9fdb..55ee9e6a16d 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -286,7 +286,7 @@ impl ser::Serialize for Target { kind: &self.kind, crate_types: self.rustc_crate_types(), name: &self.name, - src_path: src_path, + src_path, edition: &self.edition.to_string(), required_features: self .required_features