Skip to content

Commit 4f8eea2

Browse files
committed
lint: fix uninlined_format_args
1 parent ca5ffd1 commit 4f8eea2

34 files changed

+77
-87
lines changed

pad/editor/.clippy.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

pad/editor/.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.clippy.toml

pad/editor/src/backend.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,15 @@ impl SysBackend for WebBackend {
358358
uiua::StreamSeek::Start(off) => {
359359
if off >= size {
360360
Err(format!(
361-
"Tried to seek to {}, but the file stream is only {} bytes",
362-
off, size
361+
"Tried to seek to {off}, but the file stream is only {size} bytes"
363362
))?
364363
}
365364
off
366365
}
367366

368367
uiua::StreamSeek::End(off) => size.checked_sub(off).ok_or_else(|| {
369368
format!(
370-
"Tried to seek {} bytes from file stream end, but the file stream is only {} bytes",
371-
off, size
369+
"Tried to seek {off} bytes from file stream end, but the file stream is only {size} bytes"
372370
)
373371
})?,
374372
};

pad/editor/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ pub fn Editor<'a>(
326326
}
327327
OutputItem::Audio(bytes, label) => {
328328
let encoded = STANDARD.encode(bytes);
329-
let src = format!("data:audio/wav;base64,{}", encoded);
329+
let src = format!("data:audio/wav;base64,{encoded}");
330330
let label = label.map(|s| format!("{s}:"));
331331
if allow_autoplay {
332332
view! {
@@ -463,7 +463,7 @@ pub fn Editor<'a>(
463463
if code.starts_with("# Experimental!\n") || code == "# Experimental!" {
464464
return;
465465
}
466-
let new_code = format!("# Experimental!\n{}", code);
466+
let new_code = format!("# Experimental!\n{code}");
467467
let cursor = if let Some((start, end)) = get_code_cursor() {
468468
Cursor::Set(start + 16, end + 16)
469469
} else {
@@ -668,7 +668,7 @@ pub fn Editor<'a>(
668668
if i == 0 || start_line == 1 && i == end_line {
669669
Some(line.into())
670670
} else {
671-
Some(format!("\n{}", line))
671+
Some(format!("\n{line}"))
672672
}
673673
} else {
674674
None
@@ -1105,7 +1105,7 @@ pub fn Editor<'a>(
11051105
.or_else(|| prim.ascii().map(|s| s.to_string()))?;
11061106
let mut title = prim.name().to_string();
11071107
if let Some(ascii) = prim.ascii() {
1108-
title = format!("({}) {}", ascii, title);
1108+
title = format!("({ascii}) {title}");
11091109
}
11101110
// Navigate to the docs page on ctrl/shift+click
11111111
let onclick = move |event: MouseEvent| {
@@ -1396,7 +1396,7 @@ pub fn Editor<'a>(
13961396
false => "normal-editor",
13971397
};
13981398

1399-
format!("editor {} {}", editor_size, editor_layout)
1399+
format!("editor {editor_size} {editor_layout}")
14001400
};
14011401

14021402
// Hide the example arrows if there is only one example
@@ -2260,7 +2260,7 @@ pub fn Prim(
22602260
let href = format!("/docs/{}", prim.name());
22612261
let mut title = String::new();
22622262
if let Some(ascii) = prim.ascii() {
2263-
title.push_str(&format!("({})", ascii));
2263+
title.push_str(&format!("({ascii})"));
22642264
}
22652265
if prim.glyph().is_some() && glyph_only {
22662266
if !title.is_empty() {

pad/editor/src/utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl State {
212212
let line_numbers = element::<HtmlDivElement>(&self.line_numbers_id);
213213
let editor = element::<HtmlDivElement>(&self.editor_wrapper_id);
214214
let line_numbers_width = line_numbers.get_bounding_client_rect().width();
215-
let line_numbers_width_str = format!("{}px", line_numbers_width);
215+
let line_numbers_width_str = format!("{line_numbers_width}px");
216216
editor
217217
.style()
218218
.set_property("--line-numbers-width", &line_numbers_width_str)
@@ -613,7 +613,7 @@ pub fn gen_code_view(id: &str, code: &str) -> View {
613613
color_class: &str,
614614
frag_views: &mut Vec<View>,
615615
) {
616-
let class = format!("code-span code-underline {}", color_class);
616+
let class = format!("code-span code-underline {color_class}");
617617
let onmouseover = move |event: web_sys::MouseEvent| update_ctrl(&event);
618618
let onclick = move |event: web_sys::MouseEvent| {
619619
if os_ctrl(&event) {
@@ -769,7 +769,7 @@ pub fn gen_code_view(id: &str, code: &str) -> View {
769769
let mut title =
770770
format!("{}: {}", name, PrimDoc::from(prim).short_text());
771771
if let Some(ascii) = prim.ascii() {
772-
title = format!("({}) {}", ascii, title);
772+
title = format!("({ascii}) {title}");
773773
}
774774
add_prim_view(prim, text, title, color_class, &mut frag_views);
775775
}
@@ -788,7 +788,7 @@ pub fn gen_code_view(id: &str, code: &str) -> View {
788788
let class = format!("code-span {color_class}");
789789
if text == "@ " {
790790
let space_class =
791-
format!("code-span space-character {}", color_class);
791+
format!("code-span space-character {color_class}");
792792
frag_views.push(
793793
view! {
794794
<span class=class data-title="space character">
@@ -818,7 +818,7 @@ pub fn gen_code_view(id: &str, code: &str) -> View {
818818
}
819819
SpanKind::ImportSrc(ImportSrc::Git(path)) => {
820820
let title = "Git module path (Ctrl+Click to open)";
821-
let class = format!("code-span code-underline {}", color_class);
821+
let class = format!("code-span code-underline {color_class}");
822822
let onmouseover = move |event: web_sys::MouseEvent| update_ctrl(&event);
823823
let onclick = move |event: web_sys::MouseEvent| {
824824
if os_ctrl(&event) {

parser/.clippy.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

parser/.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clippy.toml

parser/src/inputs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ impl Inputs {
4848
InputSrc::File(path) => self
4949
.files
5050
.get(&**path)
51-
.unwrap_or_else(|| panic!("File {:?} not found", path))
51+
.unwrap_or_else(|| panic!("File {path:?} not found"))
5252
.clone(),
5353
InputSrc::Str(index) => self
5454
.strings
5555
.get(*index)
56-
.unwrap_or_else(|| panic!("String {} not found", index))
56+
.unwrap_or_else(|| panic!("String {index} not found"))
5757
.clone(),
5858
InputSrc::Macro(span) => self
5959
.macros
6060
.get(span)
61-
.unwrap_or_else(|| panic!("Macro at {} not found", span))
61+
.unwrap_or_else(|| panic!("Macro at {span} not found"))
6262
.clone(),
6363
InputSrc::Literal(s) => s.clone(),
6464
}

parser/src/lex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl fmt::Display for LexError {
9595
LexError::ExpectedCharacter(chars) if chars.len() == 2 => {
9696
write!(f, "Expected {:?} or {:?}", chars[0], chars[1])
9797
}
98-
LexError::ExpectedCharacter(chars) => write!(f, "Expected one of {:?}", chars),
98+
LexError::ExpectedCharacter(chars) => write!(f, "Expected one of {chars:?}"),
9999
LexError::InvalidEscape(c) => write!(f, "Invalid escape character {c:?}"),
100100
LexError::InvalidUnicodeEscape(c) => write!(f, "Invalid unicode escape \\\\{c:x}"),
101101
LexError::InvalidEscapeSequence(c) => write!(f, "Invalid escape \\\\{c}"),
@@ -324,7 +324,7 @@ impl fmt::Display for CodeSpan {
324324
let mut file: String = path.to_string_lossy().into_owned();
325325
if let Some(s) = file.strip_prefix("C:\\Users\\") {
326326
if let Some((_, sub)) = s.split_once('\\') {
327-
file = format!("~\\{}", sub);
327+
file = format!("~\\{sub}");
328328
} else {
329329
file = s.to_string();
330330
}

parser/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl fmt::Display for Expectation {
5656
Expectation::ArgsOutputs => write!(f, "arguments and outputs count"),
5757
Expectation::ItemName => write!(f, "item name"),
5858
Expectation::Token(Simple(s)) => write!(f, "`{s}`"),
59-
Expectation::Token(tok) => write!(f, "{:?}", tok),
59+
Expectation::Token(tok) => write!(f, "{tok:?}"),
6060
Expectation::CloseModule => write!(f, "`---`"),
6161
}
6262
}

0 commit comments

Comments
 (0)