aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp A2020-11-13 11:02:58 +0100
committerPhilipp A2020-11-13 11:02:58 +0100
commit3e509d064adb595e5b8838f55b971d176725bb43 (patch)
tree2c6f4a67b5a8d1e253879214aacce97f6339feeb
parentf06fe35f7537feb28c7c38b33c1bca9ff4ebd2a9 (diff)
downloadrust-rst-3e509d064adb595e5b8838f55b971d176725bb43.tar.bz2
Allow lack of trailing newline
-rw-r--r--rst/src/main.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/rst/src/main.rs b/rst/src/main.rs
index 318bcb6..1012ed1 100644
--- a/rst/src/main.rs
+++ b/rst/src/main.rs
@@ -36,7 +36,8 @@ fn main() -> CliResult {
args.verbosity.setup_env_logger("rst")?;
// TODO: somehow make it work without replacing tabs
- let content = read_file(args.file)?.replace('\t', " ".repeat(8).as_ref());
+ let mut content = read_file(args.file)?.replace('\t', " ".repeat(8).as_ref());
+ if !content.ends_with('\n') { content.push('\n'); } // Allows less complex grammar
let document = parse(&content)?;
let stdout = std::io::stdout();
match args.format {