Skip to content

Commit

Permalink
Rollup merge of rust-lang#72047 - Julian-Wollersberger:literal_error_…
Browse files Browse the repository at this point in the history
…reporting_cleanup, r=petrochenkov

Literal error reporting cleanup

While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.

This PR is probably best reviewed commit by commit.

I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.

But how do I open a PR for clippy? (Git submodules are frustrating to work with)
  • Loading branch information
RalfJung authored May 16, 2020
2 parents b381ea8 + ff9a9ed commit 8bba1b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ fn check_newlines(fmtstr: &StrLit) -> bool {
};

match fmtstr.style {
StrStyle::Cooked => unescape::unescape_str(contents, &mut cb),
StrStyle::Raw(_) => unescape::unescape_raw_str(contents, &mut cb),
StrStyle::Cooked => unescape::unescape_literal(contents, unescape::Mode::Str, &mut cb),
StrStyle::Raw(_) => unescape::unescape_literal(contents, unescape::Mode::RawStr, &mut cb),
}

should_lint
Expand Down

0 comments on commit 8bba1b7

Please sign in to comment.