From 773ab74b8781578b06c476ea7ed06cc8b35e374f Mon Sep 17 00:00:00 2001 From: Rustin-Liu Date: Sat, 11 Jul 2020 00:16:21 +0800 Subject: [PATCH 1/2] fix: add space to comments --- src/cargo/ops/cargo_new.rs | 4 ++-- tests/testsuite/init.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index fbd2a1637b3..9bbcc6d9f54 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -524,12 +524,12 @@ impl IgnoreList { _ => &self.ignore, }; - let mut out = "\n\n#Added by cargo\n".to_string(); + let mut out = "\n\n# Added by cargo\n".to_string(); if ignore_items .iter() .any(|item| existing_items.contains(item)) { - out.push_str("#\n#already existing elements were commented out\n"); + out.push_str("#\n# already existing elements were commented out\n"); } out.push('\n'); diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs index 9acc01f408a..561e84f09fb 100644 --- a/tests/testsuite/init.rs +++ b/tests/testsuite/init.rs @@ -82,9 +82,9 @@ fn simple_git_ignore_exists() { contents, "/target\n\ **/some.file\n\n\ - #Added by cargo\n\ + # Added by cargo\n\ #\n\ - #already existing elements were commented out\n\ + # already existing elements were commented out\n\ \n\ #/target\n\ Cargo.lock\n", From 9ede5267ce1bced7b0b6f15a3f555929df09fd8a Mon Sep 17 00:00:00 2001 From: Rustin-Liu Date: Sat, 11 Jul 2020 10:36:49 +0800 Subject: [PATCH 2/2] fix: refine test --- tests/testsuite/init.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs index 561e84f09fb..9cbcdf0686a 100644 --- a/tests/testsuite/init.rs +++ b/tests/testsuite/init.rs @@ -108,7 +108,7 @@ fn git_ignore_exists_no_conflicting_entries() { assert_eq!( contents, "**/some.file\n\n\ - #Added by cargo\n\ + # Added by cargo\n\ \n\ /target\n\ Cargo.lock\n",