Skip to content

Commit

Permalink
fix: get pretty_print_rule() to work
Browse files Browse the repository at this point in the history
Co-Authored-By: Andrew Thrasher <1165729+adthrasher@users.noreply.github.com>
  • Loading branch information
a-frantz and adthrasher committed Jun 3, 2024
1 parent d4c943b commit 387b99a
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/commands/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ pub struct Args {
pub rule_identifier: String,
}

/// TODO IDK how to get this fn signature to work with both ast_lint and
/// grammar_lint
pub fn pretty_print_rule<E>(rule: &dyn Rule<E>) {
println!("{}", rule.name().bold().underline());
println!("{}", format!("{}::{}", rule.code(), rule.tags(),).yellow());
Expand All @@ -31,11 +29,7 @@ pub fn explain(args: Args) -> anyhow::Result<()> {

match rule {
Some(rule) => {
// pretty_print_rule(&rule);
println!("{}", rule.name().bold().underline());
println!("{}", format!("{}::{}", rule.code(), rule.tags(),).yellow());
println!();
println!("{}", rule.body());
pretty_print_rule(&*rule);
}
None => {
let rule = ast_lint::rules()
Expand All @@ -44,11 +38,7 @@ pub fn explain(args: Args) -> anyhow::Result<()> {

match rule {
Some(rule) => {
// pretty_print_rule(&rule);
println!("{}", rule.name().bold().underline());
println!("{}", format!("{}::{}", rule.code(), rule.tags(),).yellow());
println!();
println!("{}", rule.body());
pretty_print_rule(&*rule);
}
None => {
anyhow::bail!("No rule found with the identifier '{}'", ident);
Expand Down

0 comments on commit 387b99a

Please sign in to comment.