Skip to content

Commit 91e709b

Browse files
noahgiftclaude
andcommitted
fix(quality): resolve clippy warnings for 2.0 release
- Fix Cargo.toml: empty_enums → empty_enum (correct lint name) - Fix CellBuffer Debug impl: use finish_non_exhaustive() - Fix doc comments: use backticks for code in docs - Fix doc formatting: proper paragraph separation - Auto-fix uninlined_format_args across computebrick/*.rs Quality metrics: - Clippy: 0 errors, 0 warnings - Tests: 16,102 passed, 0 failed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 65442a7 commit 91e709b

File tree

9 files changed

+25
-24
lines changed

9 files changed

+25
-24
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ cloned_instead_of_copied = "warn"
3838
cognitive_complexity = "allow" # Test functions can be complex
3939
default_trait_access = "allow" # Tests can use Default::default() explicitly
4040
doc_markdown = "warn"
41-
empty_enums = "warn"
41+
empty_enum = "warn"
4242
enum_variant_names = "warn"
4343
expl_impl_clone_on_copy = "warn"
4444
explicit_deref_methods = "warn"

src/computebrick/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn plot(
5151
/// * `value` - Current value
5252
/// * `max` - Maximum value
5353
/// * `label` - Optional label
54-
/// * `gradient` - Optional gradient colors ["start", "end"]
54+
/// * `gradient` - Optional gradient colors `["start", "end"]`
5555
///
5656
/// # Example
5757
/// ```ruchy

src/computebrick/canvas.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl fmt::Debug for CellBuffer {
410410
f.debug_struct("CellBuffer")
411411
.field("width", &self.width)
412412
.field("height", &self.height)
413-
.finish()
413+
.finish_non_exhaustive()
414414
}
415415
}
416416

@@ -506,7 +506,7 @@ impl Canvas for CellBuffer {
506506
}
507507

508508
fn draw_braille(&mut self, x: f32, y: f32, pattern: u8, color: Color) {
509-
let ch = char::from_u32(0x2800 + pattern as u32).unwrap_or(' ');
509+
let ch = char::from_u32(0x2800 + u32::from(pattern)).unwrap_or(' ');
510510
self.set_char(x as usize, y as usize, ch, color, Color::TRANSPARENT);
511511
}
512512
}

src/computebrick/render.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::io::{self, Write};
1010
pub enum RenderBackend {
1111
/// Direct terminal via crossterm.
1212
Terminal,
13-
/// WebAssembly Canvas2D.
13+
/// WebAssembly `Canvas2D`.
1414
WasmCanvas,
1515
/// WebAssembly WebGL.
1616
WasmWebGL,
@@ -216,11 +216,11 @@ impl DiffRenderer {
216216
match self.color_mode {
217217
ColorMode::TrueColor => {
218218
let (r, g, b) = color.to_rgb8();
219-
write!(output, "\x1b[38;2;{};{};{}m", r, g, b)?;
219+
write!(output, "\x1b[38;2;{r};{g};{b}m")?;
220220
}
221221
ColorMode::Color256 => {
222222
let idx = color_to_256(color);
223-
write!(output, "\x1b[38;5;{}m", idx)?;
223+
write!(output, "\x1b[38;5;{idx}m")?;
224224
}
225225
ColorMode::Color16 | ColorMode::Color8 => {
226226
let idx = color_to_16(color);
@@ -236,11 +236,11 @@ impl DiffRenderer {
236236
match self.color_mode {
237237
ColorMode::TrueColor => {
238238
let (r, g, b) = color.to_rgb8();
239-
write!(output, "\x1b[48;2;{};{};{}m", r, g, b)?;
239+
write!(output, "\x1b[48;2;{r};{g};{b}m")?;
240240
}
241241
ColorMode::Color256 => {
242242
let idx = color_to_256(color);
243-
write!(output, "\x1b[48;5;{}m", idx)?;
243+
write!(output, "\x1b[48;5;{idx}m")?;
244244
}
245245
ColorMode::Color16 | ColorMode::Color8 => {
246246
let idx = color_to_16(color);
@@ -273,7 +273,7 @@ impl Default for DiffRenderer {
273273
}
274274
}
275275

276-
/// Clone a CellBuffer (for diff comparison).
276+
/// Clone a `CellBuffer` (for diff comparison).
277277
fn clone_buffer(buffer: &CellBuffer) -> CellBuffer {
278278
let mut new_buf = CellBuffer::new(buffer.width(), buffer.height());
279279
for y in 0..buffer.height() {
@@ -302,9 +302,9 @@ fn color_to_256(color: Color) -> u8 {
302302
}
303303

304304
// Map to 6x6x6 color cube (indices 16-231)
305-
let r_idx = (r as u16 * 5 / 255) as u8;
306-
let g_idx = (g as u16 * 5 / 255) as u8;
307-
let b_idx = (b as u16 * 5 / 255) as u8;
305+
let r_idx = (u16::from(r) * 5 / 255) as u8;
306+
let g_idx = (u16::from(g) * 5 / 255) as u8;
307+
let b_idx = (u16::from(b) * 5 / 255) as u8;
308308

309309
16 + 36 * r_idx + 6 * g_idx + b_idx
310310
}

src/computebrick/widgets.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl BrailleGraph {
145145
if right_dots >= 3 { pattern |= 0x10; } // dot 5
146146
if right_dots >= 4 { pattern |= 0x08; } // dot 4
147147

148-
char::from_u32(0x2800 + pattern as u32).unwrap_or(' ')
148+
char::from_u32(0x2800 + u32::from(pattern)).unwrap_or(' ')
149149
}
150150

151151
/// Get block character for value.
@@ -534,7 +534,7 @@ impl Table {
534534
}
535535

536536
fn compute_column_widths(headers: &[String], rows: &[Vec<String>]) -> Vec<usize> {
537-
let mut widths: Vec<usize> = headers.iter().map(|h| h.len()).collect();
537+
let mut widths: Vec<usize> = headers.iter().map(std::string::String::len).collect();
538538

539539
for row in rows {
540540
for (i, cell) in row.iter().enumerate() {

src/frontend/parser/expressions_helpers/string_operations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ fn flush_text_part(parts: &mut Vec<StringPart>, current: &mut String) {
112112
/// - `{expr}` - Simple expression
113113
/// - `{expr:format}` - Expression with format specifier
114114
/// - `{}` - Empty placeholder (positional argument)
115-
/// Fixed: Don't confuse :: (path separator) with : (format specifier)
115+
///
116+
/// Note: Don't confuse `::` (path separator) with `:` (format specifier)
116117
fn parse_interpolation(expr_str: &str) -> Result<StringPart> {
117118
use crate::frontend::parser::Parser;
118119

src/runtime/eval_array.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,15 +602,15 @@ fn eval_array_sort(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
602602
}
603603

604604
/// PIPELINE-001: Reverse array order
605-
/// Enables: arr |> reverse or arr.reverse()
605+
/// Enables: arr |> reverse or `arr.reverse()`
606606
fn eval_array_reverse(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
607607
let mut reversed = arr.to_vec();
608608
reversed.reverse();
609609
Ok(Value::Array(Arc::from(reversed)))
610610
}
611611

612612
/// BOOK-200: Sum all numeric elements in array
613-
/// Enables: [1, 2, 3] |> sum() => 6
613+
/// Enables: [1, 2, 3] |> `sum()` => 6
614614
fn eval_array_sum(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
615615
let mut int_sum: i64 = 0;
616616
let mut float_sum: f64 = 0.0;
@@ -639,7 +639,7 @@ fn eval_array_sum(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
639639
}
640640

641641
/// BOOK-200: Compute product of all numeric elements
642-
/// Enables: [1, 2, 3] |> product() => 6
642+
/// Enables: [1, 2, 3] |> `product()` => 6
643643
fn eval_array_product(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
644644
if arr.is_empty() {
645645
return Ok(Value::Integer(1)); // Identity for multiplication
@@ -672,7 +672,7 @@ fn eval_array_product(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
672672
}
673673

674674
/// BOOK-200: Find minimum numeric element
675-
/// Enables: [3, 1, 4] |> min() => 1
675+
/// Enables: [3, 1, 4] |> `min()` => 1
676676
fn eval_array_min(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
677677
if arr.is_empty() {
678678
return Ok(Value::Nil);
@@ -705,7 +705,7 @@ fn eval_array_min(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
705705
}
706706

707707
/// BOOK-200: Find maximum numeric element
708-
/// Enables: [3, 1, 4] |> max() => 4
708+
/// Enables: [3, 1, 4] |> `max()` => 4
709709
fn eval_array_max(arr: &Arc<[Value]>) -> Result<Value, InterpreterError> {
710710
if arr.is_empty() {
711711
return Ok(Value::Nil);
@@ -768,7 +768,7 @@ fn eval_array_skip(arr: &Arc<[Value]>, count: &Value) -> Result<Value, Interpret
768768
}
769769

770770
/// BOOK-200: Zip two arrays together into array of tuples
771-
/// Enables: [1, 2].zip(["a", "b"]) => [(1, "a"), (2, "b")]
771+
/// Enables: `[1, 2].zip(["a", "b"]) => [(1, "a"), (2, "b")]`
772772
fn eval_array_zip(arr: &Arc<[Value]>, other: &Value) -> Result<Value, InterpreterError> {
773773
match other {
774774
Value::Array(other_arr) => {

src/runtime/eval_string_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn eval_string_repeat(s: &str, count: &Value) -> Result<Value, InterpreterError>
194194
/// Cyclomatic complexity: 2
195195
fn eval_string_append(s: &Arc<str>, suffix: &Value) -> Result<Value, InterpreterError> {
196196
if let Value::String(suffix_str) = suffix {
197-
Ok(Value::from_string(format!("{}{}", s, suffix_str)))
197+
Ok(Value::from_string(format!("{s}{suffix_str}")))
198198
} else {
199199
Err(InterpreterError::RuntimeError(
200200
"append expects string argument".to_string(),

src/runtime/interpreter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7311,7 +7311,7 @@ impl Interpreter {
73117311
result
73127312
.into_iter()
73137313
.take(provided_count)
7314-
.filter_map(|opt| opt)
7314+
.flatten()
73157315
.collect()
73167316
}
73177317

0 commit comments

Comments
 (0)