Skip to content

Commit 3287de1

Browse files
committed
lint: fix clippy::pedantic (2 entries)
1 parent a02c8b4 commit 3287de1

File tree

13 files changed

+38
-37
lines changed

13 files changed

+38
-37
lines changed

Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ print_stdout = "warn"
1717
print_stderr = "allow"
1818
dbg_macro = "warn"
1919
pedantic = {level = "warn", priority = -1}
20-
implicit_clone = "allow" # 2
21-
inconsistent_struct_constructor = "allow" # 2
22-
match_bool = "allow" # 2
23-
no_mangle_with_rust_abi = "allow" # 2
24-
struct_excessive_bools = "allow" # 2
25-
struct_field_names = "allow" # 2
26-
unicode_not_nfc = "allow" # 2
27-
unused_self = "allow" # 2
2820
case_sensitive_file_extension_comparisons = "allow" # 3
2921
cloned_instead_of_copied = "allow" # 3
3022
ref_as_ptr = "allow" # 3

pad/editor/src/backend.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl WebBackend {
144144
}
145145
panic!("Ran out of file handles");
146146
}
147-
fn file<T>(&self, path: &Path, f: impl FnOnce(&[u8]) -> T) -> Result<T, String> {
147+
fn file<T>(path: &Path, f: impl FnOnce(&[u8]) -> T) -> Result<T, String> {
148148
FILES.with(|files| {
149149
let files = files.borrow();
150150
files
@@ -251,10 +251,10 @@ impl SysBackend for WebBackend {
251251
Ok(set.into_iter().collect())
252252
}
253253
fn is_file(&self, path: &str) -> Result<bool, String> {
254-
Ok(self.file(path.as_ref(), |_| {}).is_ok())
254+
Ok(Self::file(path.as_ref(), |_| {}).is_ok())
255255
}
256256
fn file_exists(&self, path: &str) -> bool {
257-
self.file(path.as_ref(), |_| {}).is_ok()
257+
Self::file(path.as_ref(), |_| {}).is_ok()
258258
}
259259
fn file_write_all(&self, path: &Path, contents: &[u8]) -> Result<(), String> {
260260
FILES.with(|files| {
@@ -267,7 +267,7 @@ impl SysBackend for WebBackend {
267267
Ok(())
268268
}
269269
fn file_read_all(&self, path: &Path) -> Result<Vec<u8>, String> {
270-
self.file(path, |contents| contents.to_vec())
270+
Self::file(path, |contents| contents.to_vec())
271271
}
272272
fn open_file(&self, path: &Path, write: bool) -> Result<Handle, String> {
273273
let handle = self.new_handle();

pad/editor/src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,10 @@ pub fn Editor<'a>(
13911391
EditorMode::Showcase | EditorMode::Pad => "medium-editor",
13921392
};
13931393

1394-
let editor_layout = match fullscreen_enabled.get() {
1395-
true => "fullscreen-editor",
1396-
false => "normal-editor",
1394+
let editor_layout = if fullscreen_enabled.get() {
1395+
"fullscreen-editor"
1396+
} else {
1397+
"normal-editor"
13971398
};
13981399

13991400
format!("editor {editor_size} {editor_layout}")
@@ -1448,13 +1449,7 @@ pub fn Editor<'a>(
14481449
.unwrap()
14491450
.unchecked_into::<HtmlBodyElement>()
14501451
.style()
1451-
.set_property(
1452-
"overflow",
1453-
match *s {
1454-
true => "hidden",
1455-
false => "auto",
1456-
},
1457-
);
1452+
.set_property("overflow", if *s { "hidden" } else { "auto" });
14581453
if !*s {
14591454
set_timeout(
14601455
move || state.update(|state| state.update_line_number_width()),

parser/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ impl Parser<'_> {
666666
let close_span = self.exact(CloseParen.into());
667667
validator = Some(FieldValidator {
668668
open_span,
669-
close_span,
670669
words,
670+
close_span,
671671
});
672672
}
673673

site/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ fn site() {
630630
continue;
631631
}
632632
threads.push((
633-
path.to_path_buf(),
633+
path.clone(),
634634
code.clone(),
635635
std::thread::spawn(move || {
636636
(

site/src/tutorial.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ impl IntoParam for TutorialPage {
144144
}
145145
}
146146

147+
#[expect(
148+
clippy::unicode_not_nfc,
149+
reason = "the suggested CJK characters don't look as good",
150+
// TODO: maybe replace with better "arrows" that don't use characters
151+
)]
147152
#[component]
148153
fn TutorialNav(page: TutorialPage) -> impl IntoView {
149154
let next = move || {

src/algorithm/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ fn path_impl(
254254
let mut env = PathEnv {
255255
env,
256256
neighbors,
257-
heuristic,
258257
is_goal,
258+
heuristic,
259259
args,
260260
};
261261

src/compile/data.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ impl Compiler {
581581

582582
Ok(())
583583
}
584+
#[expect(clippy::unused_self, reason = "seems to be TBI")]
584585
pub(super) fn end_enum(&mut self) -> UiuaResult {
585586
Ok(())
586587
}

src/compile/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ struct CurrentBinding {
201201
}
202202

203203
/// A scope where names are defined
204+
#[expect(
205+
clippy::struct_excessive_bools,
206+
reason = "doesn't seem to be a state machine"
207+
)]
204208
#[derive(Debug, Clone)]
205209
pub(crate) struct Scope {
206210
kind: ScopeKind,

src/fill.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{Array, Boxed, Complex, SubSide, Uiua, Value};
22

33
pub struct Fill<'a> {
44
env: &'a Uiua,
5-
value_fill: fn(env: &'a Uiua) -> Option<&'a FillValue>,
6-
other_value_fill: fn(env: &'a Uiua) -> Option<&'a FillValue>,
5+
value: fn(env: &'a Uiua) -> Option<&'a FillValue>,
6+
other_value: fn(env: &'a Uiua) -> Option<&'a FillValue>,
77
other_error: &'static str,
88
}
99

@@ -44,21 +44,21 @@ impl<'a> Fill<'a> {
4444
pub fn new(env: &'a Uiua) -> Self {
4545
Self {
4646
env,
47-
value_fill: Uiua::value_fill,
48-
other_value_fill: Uiua::value_unfill,
47+
value: Uiua::value_fill,
48+
other_value: Uiua::value_unfill,
4949
other_error: ". An unfill is set, but not a normal fill.",
5050
}
5151
}
5252
pub fn new_un(env: &'a Uiua) -> Self {
5353
Self {
5454
env,
55-
value_fill: Uiua::value_unfill,
56-
other_value_fill: Uiua::value_fill,
55+
value: Uiua::value_unfill,
56+
other_value: Uiua::value_fill,
5757
other_error: ". A normal fill is set, but not an unfill.",
5858
}
5959
}
6060
pub fn value(&self) -> Option<&FillValue> {
61-
(self.value_fill)(self.env)
61+
(self.value)(self.env)
6262
}
6363
fn value_map<U>(
6464
&self,
@@ -178,7 +178,7 @@ impl<'a> Fill<'a> {
178178
Some(Value::Complex(_)) => ". A complex fill is set, but it is not a scalar.",
179179
Some(Value::Box(_)) => ". A box fill is set, but it is not a scalar.",
180180
None => {
181-
if (self.other_value_fill)(self.env).is_some() {
181+
if (self.other_value)(self.env).is_some() {
182182
self.other_error
183183
} else {
184184
""
@@ -197,7 +197,7 @@ impl<'a> Fill<'a> {
197197
}
198198
Some(Value::Box(_)) => ". A box fill is set, but the array is not boxed values.",
199199
None => {
200-
if (self.other_value_fill)(self.env).is_some() {
200+
if (self.other_value)(self.env).is_some() {
201201
self.other_error
202202
} else {
203203
""

0 commit comments

Comments
 (0)