Fix building without compare feature.
All checks were successful
rustfmt Build rustfmt has succeeded
rust-test Build rust-test has succeeded
rust-build Build rust-build has succeeded

This commit is contained in:
Tom Alexander 2023-08-17 00:10:14 -04:00
parent 5686256039
commit 2cd6f736c2
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -37,10 +37,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn main_body() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(not(feature = "compare"))]
let org_contents = "";
#[cfg(feature = "compare")]
let org_contents = read_stdin_to_string()?;
run_compare(org_contents)
}
#[cfg(feature = "compare")]
fn read_stdin_to_string() -> Result<String, Box<dyn std::error::Error>> {
let mut stdin_contents = String::new();
std::io::stdin()
@ -75,7 +79,7 @@ fn run_compare<P: AsRef<str>>(org_contents: P) -> Result<(), Box<dyn std::error:
}
#[cfg(not(feature = "compare"))]
fn run_compare<P: AsRef<Path>>(_todo_org_path: P) -> Result<(), Box<dyn std::error::Error>> {
fn run_compare<P: AsRef<str>>(_org_contents: P) -> Result<(), Box<dyn std::error::Error>> {
println!("This program was built with compare disabled. Doing nothing.");
Ok(())
}