Skip to content

Commit f6e52da

Browse files
committed
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.
1 parent 5197f21 commit f6e52da

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

regex-syntax/src/ast/print.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,16 @@ impl Printer {
5757
/// here are a `fmt::Formatter` (which is available in `fmt::Display`
5858
/// implementations) or a `&mut String`.
5959
pub fn print<W: fmt::Write>(&mut self, ast: &Ast, wtr: W) -> fmt::Result {
60-
visitor::visit(ast, Writer { printer: self, wtr: wtr })
60+
visitor::visit(ast, Writer { wtr })
6161
}
6262
}
6363

6464
#[derive(Debug)]
65-
struct Writer<'p, W> {
66-
printer: &'p mut Printer,
65+
struct Writer<W> {
6766
wtr: W,
6867
}
6968

70-
impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
69+
impl<W: fmt::Write> Visitor for Writer<W> {
7170
type Output = ();
7271
type Err = fmt::Error;
7372

@@ -153,7 +152,7 @@ impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
153152
}
154153
}
155154

156-
impl<'p, W: fmt::Write> Writer<'p, W> {
155+
impl<W: fmt::Write> Writer<W> {
157156
fn fmt_group_pre(&mut self, ast: &ast::Group) -> fmt::Result {
158157
use crate::ast::GroupKind::*;
159158
match ast.kind {

regex-syntax/src/hir/print.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,16 @@ impl Printer {
6565
/// here are a `fmt::Formatter` (which is available in `fmt::Display`
6666
/// implementations) or a `&mut String`.
6767
pub fn print<W: fmt::Write>(&mut self, hir: &Hir, wtr: W) -> fmt::Result {
68-
visitor::visit(hir, Writer { printer: self, wtr: wtr })
68+
visitor::visit(hir, Writer { wtr })
6969
}
7070
}
7171

7272
#[derive(Debug)]
73-
struct Writer<'p, W> {
74-
printer: &'p mut Printer,
73+
struct Writer<W> {
7574
wtr: W,
7675
}
7776

78-
impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
77+
impl<W: fmt::Write> Visitor for Writer<W> {
7978
type Output = ();
8079
type Err = fmt::Error;
8180

@@ -209,7 +208,7 @@ impl<'p, W: fmt::Write> Visitor for Writer<'p, W> {
209208
}
210209
}
211210

212-
impl<'p, W: fmt::Write> Writer<'p, W> {
211+
impl<W: fmt::Write> Writer<W> {
213212
fn write_literal_char(&mut self, c: char) -> fmt::Result {
214213
if is_meta_character(c) {
215214
self.wtr.write_str("\\")?;

0 commit comments

Comments
 (0)