Skip to content

Commit 18bb3c4

Browse files
committed
lint: fix clippy::pedantic (5 entries)
1 parent d9e7c55 commit 18bb3c4

File tree

16 files changed

+26
-28
lines changed

16 files changed

+26
-28
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ print_stdout = "warn"
1717
print_stderr = "allow"
1818
dbg_macro = "warn"
1919
pedantic = {level = "warn", priority = -1}
20-
doc_markdown = "allow" # 5
21-
match_wildcard_for_single_variants = "allow" # 5
22-
needless_continue = "allow" # 5
23-
range_plus_one = "allow" # 5
2420
if_not_else = "allow" # 6
2521
manual_let_else = "allow" # 6
2622
single_char_pattern = "allow" # 6

parser/src/lex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ impl<'a> Lexer<'a> {
13511351
while self.next_char_exact(" ") || self.next_char_exact("\t") {}
13521352
self.end(Spaces, start)
13531353
}
1354-
c if c.chars().all(|c| c.is_whitespace()) => continue,
1354+
c if c.chars().all(|c| c.is_whitespace()) => {}
13551355
c => {
13561356
if c.chars().count() == 1 {
13571357
let c = c.chars().next().unwrap();

parser/src/parse.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,7 @@ impl Parser<'_> {
386386
loop {
387387
if let Some(ident) = self.ident() {
388388
items.push(ident);
389-
} else if self.spaces().is_some() {
390-
continue;
391-
} else {
389+
} else if self.spaces().is_none() {
392390
break;
393391
}
394392
}

parser/src/split.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ pub fn split_name(name: &str) -> Option<Vec<(PrimComponent, &str)>> {
280280
'p' => Primitive::Pop,
281281
_ => unreachable!(),
282282
};
283-
prims.push((prim.into(), &sub_name[i..i + 1]))
283+
prims.push((prim.into(), &sub_name[i..=i]))
284284
}
285285
start += len;
286286
continue 'outer;
@@ -346,7 +346,7 @@ pub fn split_name(name: &str) -> Option<Vec<(PrimComponent, &str)>> {
346346
'p' => Primitive::Pop,
347347
_ => unreachable!(),
348348
};
349-
prims.push((prim.into(), &sub_name[i..i + 1]))
349+
prims.push((prim.into(), &sub_name[i..=i]))
350350
}
351351
end -= len;
352352
continue 'outer;
@@ -364,7 +364,7 @@ pub fn split_name(name: &str) -> Option<Vec<(PrimComponent, &str)>> {
364364
'f' => Primitive::Fix,
365365
_ => unreachable!(),
366366
};
367-
prims.push((prim.into(), &sub_name[i..i + 1]))
367+
prims.push((prim.into(), &sub_name[i..=i]))
368368
}
369369
end -= len;
370370
continue 'outer;

src/algorithm/dyadic/combine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ impl Value {
10701070
Value::Char(_) => {
10711071
return Err(ctx.error("Cannot combine number and character arrays"))
10721072
}
1073-
_ => {}
1073+
Value::Byte(_) => {}
10741074
}
10751075
}
10761076
row_values = values.into_iter();
@@ -1121,7 +1121,7 @@ impl Value {
11211121
Value::Complex(_) => {
11221122
return Err(ctx.error("Cannot combine character and complex arrays"))
11231123
}
1124-
_ => {}
1124+
Value::Char(_) => {}
11251125
}
11261126
}
11271127
row_values = values.into_iter();

src/algorithm/dyadic/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ impl<T: ArrayValue> Array<T> {
395395
new_shape.extend_from_slice(&self.shape);
396396
self.shape = new_shape.into();
397397
}
398-
_ => {}
398+
Ordering::Equal => {}
399399
}
400400

401401
// If converting to rank 0, the rank-matching process
@@ -459,7 +459,7 @@ impl Value {
459459
if irank >= 0 {
460460
// Positive rank
461461
if rank >= shape.len() {
462-
for _ in 0..rank - shape.len() + 1 {
462+
for _ in 0..=rank - shape.len() {
463463
shape.prepend(1);
464464
}
465465
} else {

src/algorithm/map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,13 @@ impl MapKeys {
446446
&key_data[key_index * key_row_len..(key_index + 1) * key_row_len];
447447
if cell_key[0].is_any_tombstone() {
448448
continue;
449-
} else if cell_key[0].is_any_empty_cell() {
449+
}
450+
if cell_key[0].is_any_empty_cell() {
450451
key_index = orig;
451452
break false;
452-
} else if ArrayCmpSlice(cell_key) == ArrayCmpSlice(&key.data) {
453+
}
454+
if ArrayCmpSlice(cell_key) == ArrayCmpSlice(&key.data) {
453455
break true;
454-
} else {
455-
continue;
456456
}
457457
}
458458
} else {

src/algorithm/media.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ pub enum SmartOutput {
3131
const MIN_AUTO_IMAGE_DIM: usize = 30;
3232

3333
impl SmartOutput {
34-
/// Convert a value to a SmartOutput
34+
/// Convert a value to a `SmartOutput`
3535
///
3636
/// Animations default to GIF
3737
pub fn from_value(value: Value, frame_rate: f64, backend: &dyn SysBackend) -> Self {
3838
Self::from_value_impl(value, frame_rate, false, backend)
3939
}
40-
/// Convert a value to a SmartOutput
40+
/// Convert a value to a `SmartOutput`
4141
///
4242
/// Animations default to APNG
4343
pub fn from_value_prefer_apng(value: Value, frame_rate: f64, backend: &dyn SysBackend) -> Self {

src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl<T: ArrayValue> Array<T> {
603603
row.meta.take_label();
604604
return row;
605605
}
606-
let row_count: usize = self.shape[..depth + 1].iter().product();
606+
let row_count: usize = self.shape[..=depth].iter().product();
607607
if row >= row_count {
608608
panic!("row index out of bounds: {row} >= {row_count}");
609609
}

src/compile/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ impl Compiler {
434434
};
435435
for field in &fields {
436436
match field.init.as_ref().map(|sn| sn.sig.args()) {
437-
Some(0) => continue,
437+
Some(0) => {}
438438
Some(1) | None => {
439439
constr_comment.push(' ');
440440
constr_comment.push_str(&field.name);

0 commit comments

Comments
 (0)