Skip to content

Commit 3255c71

Browse files
committed
lint: fix clippy::default_trait_access
1 parent f5fb357 commit 3255c71

File tree

17 files changed

+34
-31
lines changed

17 files changed

+34
-31
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ print_stderr = "allow"
1818
dbg_macro = "warn"
1919
pedantic = {level = "warn", priority = -1}
2020
inline_always = "allow" # TODO: benchmark inlines
21-
default_trait_access = "allow" # 23
2221
format_push_string = "allow" # 27
2322
missing_panics_doc = "allow" # 37
2423
used_underscore_binding = "allow" # 39

pad/editor/src/backend.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn delete_file(path: &PathBuf) {
7070
}
7171

7272
thread_local! {
73-
static BREAKPOINTS: RefCell<HashMap<u64, (u64, usize)>> = Default::default();
73+
static BREAKPOINTS: RefCell<HashMap<u64, (u64, usize)>> = RefCell::default();
7474
}
7575

7676
impl Default for WebBackend {
@@ -434,8 +434,8 @@ impl SysBackend for WebBackend {
434434
}
435435
fn load_git_module(&self, original_url: &str, target: GitTarget) -> Result<PathBuf, String> {
436436
thread_local! {
437-
static CACHE: RefCell<HashMap<String, Result<String, String>>> = Default::default();
438-
static WORKING: RefCell<HashSet<String>> = Default::default();
437+
static CACHE: RefCell<HashMap<String, Result<String, String>>> = RefCell::default();
438+
static WORKING: RefCell<HashSet<String>> = RefCell::default();
439439
}
440440

441441
fn cache_url(url: &str, res: Result<String, String>) {

pad/editor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn Editor<'a>(
131131
let (fullscreen_enabled, set_fullscreen_enabled) = create_signal(false);
132132
let update_token_count = move |code: &str| {
133133
set_token_count.set(
134-
lex(code, (), &mut Default::default())
134+
lex(code, (), &mut uiua::Inputs::default())
135135
.0
136136
.into_iter()
137137
.filter(|tok| {

site/src/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn node_view<'a>(node: &'a AstNode<'a>) -> View {
182182
if block.literal.trim() == "LOGO" {
183183
view!(<Editor example=LOGO/>).into_view()
184184
} else if (block.info.is_empty() || block.info.starts_with("uiua"))
185-
&& uiua::parse(&block.literal, (), &mut Default::default())
185+
&& uiua::parse(&block.literal, (), &mut Inputs::default())
186186
.1
187187
.is_empty()
188188
{

src/algorithm/ga.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ use ecow::{eco_vec, EcoVec};
99
use serde::*;
1010

1111
use crate::{
12-
algorithm::pervade::derive_new_shape, grid_fmt::GridFmt, is_default, Array, Boxed, Primitive,
13-
Shape, Uiua, UiuaResult, Value,
12+
algorithm::pervade::derive_new_shape,
13+
grid_fmt::{GridFmt, GridFmtParams},
14+
is_default, Array, Boxed, Primitive, Shape, Uiua, UiuaResult, Value,
1415
};
1516

1617
macro_rules! ga_op {
@@ -1259,7 +1260,7 @@ pub fn unparse(spec: Spec, val: Value, env: &Uiua) -> UiuaResult<Value> {
12591260
}
12601261
let mask = mask_table[i];
12611262
if n.abs() != 1.0 || mask == 0 {
1262-
let n_grid = n.abs().fmt_grid(Default::default());
1263+
let n_grid = n.abs().fmt_grid(GridFmtParams::default());
12631264
s.extend(n_grid.into_iter().next().unwrap());
12641265
}
12651266
if mask == 0 {

src/algorithm/groups.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use ecow::{eco_vec, EcoVec};
77

88
use crate::{
99
cowslice::CowSlice, get_ops, types::push_empty_rows_value, val_as_arr, Array, ArrayValue,
10-
Boxed, Node, Ops, Primitive, ScalarNum, Shape, SigNode, Uiua, UiuaResult, Value,
10+
Boxed, Node, Ops, PersistentMeta, Primitive, ScalarNum, Shape, SigNode, Uiua, UiuaResult,
11+
Value,
1112
};
1213

1314
use super::multi_output;
@@ -753,7 +754,7 @@ where
753754
.collect::<UiuaResult<_>>()?;
754755

755756
if indices.shape == [0]
756-
&& push_empty_rows_value(&f, &values, false, &mut Default::default(), env)
757+
&& push_empty_rows_value(&f, &values, false, &mut PersistentMeta::default(), env)
757758
{
758759
return Ok(());
759760
}

src/algorithm/media.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ pub fn gif_bytes_to_value(bytes: &[u8]) -> Result<(f64, Value), gif::DecodingErr
740740
let first_frame = decoder.read_next_frame()?.unwrap();
741741
let gif_width = first_frame.width as usize;
742742
let gif_height = first_frame.height as usize;
743-
let mut data: crate::cowslice::CowSlice<f64> = Default::default();
743+
let mut data = crate::cowslice::CowSlice::new();
744744
let mut frame_count = 1;
745745
let mut delay_sum = first_frame.delay as f64 / 100.0;
746746
// Init frame data with the first frame

src/algorithm/pervade.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::{
88
use ecow::eco_vec;
99

1010
use crate::algorithm::validate_size;
11+
use crate::cowslice::CowSlice;
1112
use crate::fill::FillValue;
1213
use crate::{algorithm::loops::flip, array::*, Uiua, UiuaError, UiuaResult, Value};
1314
use crate::{Complex, Shape};
@@ -639,7 +640,7 @@ where
639640

640641
if new_shape.contains(&0) {
641642
b.shape = new_shape;
642-
b.data = Default::default();
643+
b.data = CowSlice::new();
643644
} else if new_shape == b.shape {
644645
// The existing array can be used
645646
if a.shape == b.shape {

src/compile/binding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ impl Compiler {
476476
sig,
477477
explicit: binding.signature.is_some(),
478478
inline: false,
479-
set_inverses: Default::default(),
479+
set_inverses: SetInverses::default(),
480480
},
481481
);
482482
}

src/compile/invert/un.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn un_inverse(input: &[Node], asm: &Assembly) -> InversionResult<Node> {
3333
}
3434

3535
thread_local! {
36-
static CACHE: RefCell<HashMap<u64, InversionResult<Node>>> = Default::default();
36+
static CACHE: RefCell<HashMap<u64, InversionResult<Node>>> = RefCell::default();
3737
}
3838
let mut hasher = DefaultHasher::new();
3939
for node in input {
@@ -95,7 +95,7 @@ fn anti_inverse(input: &[Node], asm: &Assembly, for_un: bool) -> InversionResult
9595
return generic();
9696
}
9797
thread_local! {
98-
static CACHE: RefCell<HashMap<u64, InversionResult<Node>>> = Default::default();
98+
static CACHE: RefCell<HashMap<u64, InversionResult<Node>>> = RefCell::default();
9999
}
100100
let mut hasher = DefaultHasher::new();
101101
for node in input {
@@ -445,7 +445,7 @@ inverse!(BothPat, input, asm, Both, span, [f], {
445445
let inv = f.un_inverse(asm)?;
446446
Ok((
447447
input,
448-
ImplMod(UnBothImpl(Default::default()), eco_vec![inv], span),
448+
ImplMod(UnBothImpl(Subscript::default()), eco_vec![inv], span),
449449
))
450450
});
451451

0 commit comments

Comments
 (0)