syntax: fix 'unused' warnings

It looks like the dead code detector got smarter. We never ended up
using the 'printer' field in these visitors, so just get rid of it.
This commit is contained in:
Andrew Gallant
2022-02-25 12:48:26 -05:00
parent 3b200d9c21
commit 3a26c4275e
2 changed files with 8 additions and 10 deletions
+4 -5
View File
@@ -57,17 +57,16 @@ impl Printer {
/// here are a `fmt::Formatter` (which is available in `fmt::Display`
/// implementations) or a `&mut String`.
pub fn print<W: fmt::Write>(&mut self, ast: &Ast, wtr: W) -> fmt::Result {
visitor::visit(ast, Writer { printer: self, wtr: wtr })
visitor::visit(ast, Writer { wtr })
}
}
#[derive(Debug)]
struct Writer<'p, W> {
printer: &'p mut Printer,
struct Writer<W> {
wtr: W,
}
impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
impl<W: fmt::Write> Visitor for Writer<W> {
type Output = ();
type Err = fmt::Error;
@@ -153,7 +152,7 @@ impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
}
}
impl<'p, W: fmt::Write> Writer<'p, W> {
impl<W: fmt::Write> Writer<W> {
fn fmt_group_pre(&mut self, ast: &ast::Group) -> fmt::Result {
use crate::ast::GroupKind::*;
match ast.kind {
+4 -5
View File
@@ -65,17 +65,16 @@ impl Printer {
/// here are a `fmt::Formatter` (which is available in `fmt::Display`
/// implementations) or a `&mut String`.
pub fn print<W: fmt::Write>(&mut self, hir: &Hir, wtr: W) -> fmt::Result {
visitor::visit(hir, Writer { printer: self, wtr: wtr })
visitor::visit(hir, Writer { wtr })
}
}
#[derive(Debug)]
struct Writer<'p, W> {
printer: &'p mut Printer,
struct Writer<W> {
wtr: W,
}
impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
impl<W: fmt::Write> Visitor for Writer<W> {
type Output = ();
type Err = fmt::Error;
@@ -209,7 +208,7 @@ impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
}
}
impl<'p, W: fmt::Write> Writer<'p, W> {
impl<W: fmt::Write> Writer<W> {
fn write_literal_char(&mut self, c: char) -> fmt::Result {
if is_meta_character(c) {
self.wtr.write_str("\\")?;