Account for format_args in HiddenUnicodeCodepoints lint
This commit is contained in:
parent
c6afe82b8a
commit
ea291e5b5f
9 changed files with 82 additions and 34 deletions
|
@ -4,6 +4,7 @@ use rustc_span::{Ident, Span, Symbol};
|
|||
|
||||
use crate::Expr;
|
||||
use crate::ptr::P;
|
||||
use crate::token::LitKind;
|
||||
|
||||
// Definitions:
|
||||
//
|
||||
|
@ -45,6 +46,10 @@ pub struct FormatArgs {
|
|||
pub span: Span,
|
||||
pub template: Vec<FormatArgsPiece>,
|
||||
pub arguments: FormatArguments,
|
||||
/// The raw, un-split format string literal, with no escaping or processing.
|
||||
///
|
||||
/// Generally only useful for lints that care about the raw bytes the user wrote.
|
||||
pub uncooked_fmt_str: (LitKind, Symbol),
|
||||
}
|
||||
|
||||
/// A piece of a format template string.
|
||||
|
|
|
@ -1596,7 +1596,7 @@ fn walk_inline_asm_sym<T: MutVisitor>(
|
|||
|
||||
fn walk_format_args<T: MutVisitor>(vis: &mut T, fmt: &mut FormatArgs) {
|
||||
// FIXME: visit the template exhaustively.
|
||||
let FormatArgs { span, template: _, arguments } = fmt;
|
||||
let FormatArgs { span, template: _, arguments, uncooked_fmt_str: _ } = fmt;
|
||||
for FormatArgument { kind, expr } in arguments.all_args_mut() {
|
||||
match kind {
|
||||
FormatArgumentKind::Named(ident) | FormatArgumentKind::Captured(ident) => {
|
||||
|
|
|
@ -1061,7 +1061,7 @@ pub fn walk_inline_asm_sym<'a, V: Visitor<'a>>(
|
|||
}
|
||||
|
||||
pub fn walk_format_args<'a, V: Visitor<'a>>(visitor: &mut V, fmt: &'a FormatArgs) -> V::Result {
|
||||
let FormatArgs { span: _, template: _, arguments } = fmt;
|
||||
let FormatArgs { span: _, template: _, arguments, uncooked_fmt_str: _ } = fmt;
|
||||
for FormatArgument { kind, expr } in arguments.all_args() {
|
||||
match kind {
|
||||
FormatArgumentKind::Named(ident) | FormatArgumentKind::Captured(ident) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue