Skip to content

Commit

Permalink
Recommend --allow-errors if no reductions are found
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett committed Mar 17, 2023
1 parent f42e29d commit a48d29c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use clap::Parser;
use clap_verbosity_flag::{InfoLevel, Verbosity};
use regex::Regex;
use tracing::debug;
use tracing::info;
use tracing_subscriber::fmt::format::FmtSpan;
use treereduce::Check;
use treereduce::CmdCheck;
Expand Down Expand Up @@ -221,7 +222,7 @@ pub fn main() -> Result<()> {
match treereduce::treereduce_multi_pass(
language,
node_types,
Original::new(tree, rs.into_bytes()),
Original::new(tree, rs.clone().into_bytes()),
Config {
check: chk,
jobs: args.jobs,
Expand All @@ -232,6 +233,9 @@ pub fn main() -> Result<()> {
) {
Err(e) => eprintln!("Failed to reduce! {e}"),
Ok((reduced, _)) => {
if reduced.text == rs.as_bytes() {
info!("Unable to reduce, try --allow-errors.");
}
std::fs::write(&args.output, reduced.text).with_context(|| {
format!("Failed to write reduced file to {}", args.output.display())
})?;
Expand Down

0 comments on commit a48d29c

Please sign in to comment.