Skip to content

Commit

Permalink
Remove dependency on tryvial
Browse files Browse the repository at this point in the history
  • Loading branch information
ErinvanderVeen committed Aug 29, 2023
1 parent 9d88566 commit 2401de2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 61 deletions.
31 changes: 0 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -67,7 +67,6 @@ tree-sitter-ocamllex = "0.20.2"
tree-sitter-query = { git = "https://github.com/nvim-treesitter/tree-sitter-query" }
tree-sitter-rust = "0.20.3"
tree-sitter-toml = "0.20.0"
tryvial = "0.2.0"
unescape = "0.1"
wasm-bindgen = "0.2.84"
wasm-bindgen-futures = "0.4.34"
Expand Down
1 change: 0 additions & 1 deletion topiary-cli/Cargo.toml
Expand Up @@ -40,7 +40,6 @@ tokio = { workspace = true, features = ["fs", "rt-multi-thread", "sync", "macros
toml = { workspace = true }
topiary = { path = "../topiary" }
tree-sitter-facade = { workspace = true }
tryvial = { workspace = true }

[dev-dependencies]
assert_cmd = { workspace = true }
Expand Down
52 changes: 24 additions & 28 deletions topiary-cli/src/main.rs
Expand Up @@ -63,34 +63,30 @@ async fn run() -> CLIResult<()> {
Err(error) => return Err(error),
};

tryvial::try_block! {
let output = OutputFile::try_from(&input)?;

log::info!(
"Formatting {}, as {} using {}, to {}",
input.source(),
input.language(),
input.query().to_string_lossy(),
output
);

let mut buf_input = BufReader::new(input);
let mut buf_output = BufWriter::new(output);

formatter(
&mut buf_input,
&mut buf_output,
&lang_def.query,
&lang_def.language,
&lang_def.grammar,
Operation::Format {
skip_idempotence,
tolerate_parsing_errors,
},
)?;

buf_output.into_inner()?.persist()?;
}
let output = OutputFile::try_from(&input)?;
log::info!(
"Formatting {}, as {} using {}, to {}",
input.source(),
input.language(),
input.query().to_string_lossy(),
output
);
let mut buf_input = BufReader::new(input);
let mut buf_output = BufWriter::new(output);
formatter(
&mut buf_input,
&mut buf_output,
&lang_def.query,
&lang_def.language,
&lang_def.grammar,
Operation::Format {
skip_idempotence,
tolerate_parsing_errors,
},
)?;
buf_output.into_inner()?.persist()?;

Ok(())
}

// This happens when the input resolver cannot establish an input
Expand Down

0 comments on commit 2401de2

Please sign in to comment.