Switch some quotes to backticks in errors (#2889)

Improves consistency with the style decision in #723, I think.
This commit is contained in:
Anders Kaseorg 2023-02-14 14:24:41 -08:00 committed by GitHub
parent 3179fc110d
commit 2e41301520
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 30 additions and 33 deletions

View file

@ -17,10 +17,7 @@ impl Violation for HashlibInsecureHashFunction {
#[derive_message_formats]
fn message(&self) -> String {
let HashlibInsecureHashFunction { string } = self;
format!(
"Probable use of insecure hash functions in `hashlib`: \"{}\"",
string.escape_debug()
)
format!("Probable use of insecure hash functions in `hashlib`: `{string}`")
}
}

View file

@ -12,7 +12,7 @@ define_violation!(
impl Violation for ShebangPython {
#[derive_message_formats]
fn message(&self) -> String {
format!("Shebang should contain \"python\"")
format!("Shebang should contain `python`")
}
}

View file

@ -55,7 +55,7 @@ impl Violation for PrefixTypeParams {
#[derive_message_formats]
fn message(&self) -> String {
let PrefixTypeParams { kind } = self;
format!("Name of private `{kind}` must start with _")
format!("Name of private `{kind}` must start with `_`")
}
}

View file

@ -42,7 +42,7 @@ define_violation!(
impl Violation for UnrecognizedPlatformCheck {
#[derive_message_formats]
fn message(&self) -> String {
format!("Unrecognized sys.platform check")
format!("Unrecognized `sys.platform` check")
}
}

View file

@ -14,7 +14,7 @@ impl AlwaysAutofixableViolation for InvalidEscapeSequence {
#[derive_message_formats]
fn message(&self) -> String {
let InvalidEscapeSequence(char) = self;
format!("Invalid escape sequence: '\\{char}'")
format!("Invalid escape sequence: `\\{char}`")
}
fn autofix_title(&self) -> String {

View file

@ -14,7 +14,7 @@ define_violation!(
impl Violation for EscapeSequenceInDocstring {
#[derive_message_formats]
fn message(&self) -> String {
format!(r#"Use r""" if any backslashes in a docstring"#)
format!(r#"Use `r"""` if any backslashes in a docstring"#)
}
}

View file

@ -12,7 +12,7 @@ define_violation!(
impl Violation for TripleSingleQuotes {
#[derive_message_formats]
fn message(&self) -> String {
format!(r#"Use """triple double quotes""""#)
format!(r#"Use triple double quotes `"""`"#)
}
}

View file

@ -125,7 +125,7 @@ impl Violation for PercentFormatUnsupportedFormatCharacter {
#[derive_message_formats]
fn message(&self) -> String {
let PercentFormatUnsupportedFormatCharacter { char } = self;
format!("`%`-format string has unsupported format character '{char}'")
format!("`%`-format string has unsupported format character `{char}`")
}
}

View file

@ -13,7 +13,7 @@ impl Violation for UselessElseOnLoop {
#[derive_message_formats]
fn message(&self) -> String {
format!(
"Else clause on loop without a break statement, remove the else and de-indent all the \
"`else` clause on loop without a `break` statement; remove the `else` and de-indent all the \
code inside it"
)
}

View file

@ -25,8 +25,8 @@ impl AlwaysAutofixableViolation for AmbiguousUnicodeCharacterString {
representant,
} = self;
format!(
"String contains ambiguous unicode character '{confusable}' (did you mean \
'{representant}'?)"
"String contains ambiguous unicode character `{confusable}` (did you mean \
`{representant}`?)"
)
}
@ -35,7 +35,7 @@ impl AlwaysAutofixableViolation for AmbiguousUnicodeCharacterString {
confusable,
representant,
} = self;
format!("Replace '{confusable}' with '{representant}'")
format!("Replace `{confusable}` with `{representant}`")
}
}
@ -53,8 +53,8 @@ impl AlwaysAutofixableViolation for AmbiguousUnicodeCharacterDocstring {
representant,
} = self;
format!(
"Docstring contains ambiguous unicode character '{confusable}' (did you mean \
'{representant}'?)"
"Docstring contains ambiguous unicode character `{confusable}` (did you mean \
`{representant}`?)"
)
}
@ -63,7 +63,7 @@ impl AlwaysAutofixableViolation for AmbiguousUnicodeCharacterDocstring {
confusable,
representant,
} = self;
format!("Replace '{confusable}' with '{representant}'")
format!("Replace `{confusable}` with `{representant}`")
}
}
@ -81,8 +81,8 @@ impl AlwaysAutofixableViolation for AmbiguousUnicodeCharacterComment {
representant,
} = self;
format!(
"Comment contains ambiguous unicode character '{confusable}' (did you mean \
'{representant}'?)"
"Comment contains ambiguous unicode character `{confusable}` (did you mean \
`{representant}`?)"
)
}
@ -91,7 +91,7 @@ impl AlwaysAutofixableViolation for AmbiguousUnicodeCharacterComment {
confusable,
representant,
} = self;
format!("Replace '{confusable}' with '{representant}'")
format!("Replace `{confusable}` with `{representant}`")
}
}