mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Shared: Clippy fixes
Use clearer methods where appropriate.
This commit is contained in:
@@ -255,15 +255,15 @@ impl DiagnosticMessage {
|
||||
match args.get(i) {
|
||||
Some(MessageArg::Code(t)) => {
|
||||
plain.push_str(t);
|
||||
if t.len() > 0 {
|
||||
if !t.is_empty() {
|
||||
let count = longest_backtick_sequence_length(t) + 1;
|
||||
markdown.push_str(&"`".repeat(count));
|
||||
if count > 1 {
|
||||
markdown.push_str(" ");
|
||||
markdown.push(' ');
|
||||
}
|
||||
markdown.push_str(t);
|
||||
if count > 1 {
|
||||
markdown.push_str(" ");
|
||||
markdown.push(' ');
|
||||
}
|
||||
markdown.push_str(&"`".repeat(count));
|
||||
}
|
||||
@@ -271,11 +271,11 @@ impl DiagnosticMessage {
|
||||
Some(MessageArg::Link(text, url)) => {
|
||||
plain.push_str(text);
|
||||
self.help_link(url);
|
||||
markdown.push_str("[");
|
||||
markdown.push('[');
|
||||
markdown.push_str(text);
|
||||
markdown.push_str("](");
|
||||
markdown.push_str(url);
|
||||
markdown.push_str(")");
|
||||
markdown.push(')');
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ impl fmt::Display for Entry {
|
||||
match self {
|
||||
Entry::FreshId(label) => write!(f, "{}=*", label),
|
||||
Entry::MapLabelToKey(label, key) => {
|
||||
write!(f, "{}=@\"{}\"", label, key.replace("\"", "\"\""))
|
||||
write!(f, "{}=@\"{}\"", label, key.replace('"', "\"\""))
|
||||
}
|
||||
Entry::GenericTuple(name, args) => {
|
||||
write!(f, "{}(", name)?;
|
||||
@@ -142,7 +142,7 @@ impl fmt::Display for Arg {
|
||||
Arg::String(x) => write!(
|
||||
f,
|
||||
"\"{}\"",
|
||||
limit_string(x, MAX_STRLEN).replace("\"", "\"\"")
|
||||
limit_string(x, MAX_STRLEN).replace('"', "\"\"")
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user