From 80133a6c6fc448de495f48ce53494f80c3f2b123 Mon Sep 17 00:00:00 2001
From: Shubham <25881429+shoebham@users.noreply.github.com>
Date: Mon, 26 Dec 2022 21:28:45 +0530
Subject: remove trailing whitespace and newline
---
src/main.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main.rs b/src/main.rs
index 438a24a..a785d03 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -490,6 +490,8 @@ fn write_readme_content(file: &mut File, in_path: &Path, raw_path: &Path)
for line in readme.split('\n') {
if line.starts_with("###") {
let line = line.get(4..).unwrap();
+ // trim the line to remove the trailing whitespace
+ let line = line.trim();
file.write_all(
format!(
r##" {}
@@ -500,6 +502,7 @@ fn write_readme_content(file: &mut File, in_path: &Path, raw_path: &Path)
)?;
} else if line.starts_with("##") {
let line = line.get(3..).unwrap();
+ let line = line.trim();
file.write_all(
format!(
r##" {}
@@ -510,6 +513,7 @@ fn write_readme_content(file: &mut File, in_path: &Path, raw_path: &Path)
)?;
} else if line.starts_with("#") {
let line = line.get(2..).unwrap();
+ let line = line.trim();
file.write_all(
format!(
r##"{}
--
cgit 1.4.1