Skip to content

Commit 4280a51

Browse files
authored
Merge pull request #16 from tamirelazar/chore/dead-code
Remove unused dependencies and dead code
2 parents 4736001 + ebbcca5 commit 4280a51

18 files changed

Lines changed: 2 additions & 193 deletions

Cargo.lock

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ clap = { version = "4.4", features = ["derive"] }
3434
clap_complete = "4.4"
3535
rand = "0.8"
3636
rand_xoshiro = "0.6"
37-
getrandom = { version = "0.2", features = ["js"] }
3837
signal-hook = { version = "0.3", optional = true }
3938
serde = { version = "1.0", features = ["derive"] }
4039
serde_json = "1.0"

src/app/runner.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,6 @@ use memory_stats::memory_stats;
5252
/// Target frame time in milliseconds for 30 FPS (33.333ms)
5353
const TARGET_FRAME_TIME_MS: f32 = 33.333;
5454

55-
/// Data structure holding all overlay states for rendering.
56-
#[derive(Default)]
57-
#[allow(dead_code)]
58-
#[allow(clippy::type_complexity)]
59-
struct OverlayData {
60-
pause_logo: Option<RenderedOverlay>,
61-
pause_logo_pos: (usize, usize),
62-
controls: Option<RenderedOverlay>,
63-
controls_pos: (usize, usize),
64-
status: Option<(String, usize, Vec<(usize, RgbColor)>)>,
65-
notification: Option<(RenderedOverlay, usize, usize)>,
66-
dashboard: Option<RenderedOverlay>,
67-
dashboard_pos: (usize, usize),
68-
config_browser: Option<RenderedOverlay>,
69-
config_browser_pos: (usize, usize),
70-
config_save: Option<RenderedOverlay>,
71-
config_save_pos: (usize, usize),
72-
keyboard_hints: Option<RenderedOverlay>,
73-
keyboard_hints_pos: (usize, usize),
74-
preset_comparison: Option<RenderedOverlay>,
75-
preset_comparison_pos: (usize, usize),
76-
palette_editor: Option<RenderedOverlay>,
77-
palette_editor_pos: (usize, usize),
78-
}
79-
8055
/// Updates food persistence attractors with fade-out effect.
8156
///
8257
/// Gradually reduces the strength of food attractors over time using

src/config_manager.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ impl SavedConfig {
435435
/// This function is part of the public API but currently unused in the main application.
436436
/// It is retained for future use in configuration management features like
437437
/// "Restart with saved config" or "Export config to file".
438-
#[allow(dead_code)]
439438
pub fn to_sim_config(&self) -> Result<SimConfig, String> {
440439
let diffusion_kernel = parse_diffusion_kernel(&self.diffusion_kernel)?;
441440
let _init_mode = parse_init_mode(&self.init_mode)?;
@@ -534,7 +533,6 @@ fn parse_diffusion_kernel(s: &str) -> Result<DiffusionKernel, String> {
534533
///
535534
/// This function is part of the configuration parsing API but currently unused.
536535
/// It is retained for future use in saved configuration loading.
537-
#[allow(dead_code)]
538536
fn parse_init_mode(s: &str) -> Result<InitMode, String> {
539537
match s.to_lowercase().as_str() {
540538
"random" => Ok(InitMode::Random),
@@ -550,7 +548,6 @@ fn parse_init_mode(s: &str) -> Result<InitMode, String> {
550548
}
551549
}
552550

553-
#[allow(dead_code)]
554551
fn parse_charset(s: &str) -> Result<Charset, String> {
555552
match s.to_lowercase().as_str() {
556553
"halfblock" => Ok(Charset::HalfBlock),
@@ -664,7 +661,6 @@ pub fn save_config(config: SavedConfig) -> Result<(), String> {
664661
/// This function is part of the public API but currently unused in the main application.
665662
/// It is retained for future use in configuration management features like
666663
/// "Load saved preset by name" or CLI config restoration.
667-
#[allow(dead_code)]
668664
pub fn load_config(name: &str) -> Result<SavedConfig, String> {
669665
let config_file = load_config_file()?;
670666

src/render/adaptive_brightness.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
#[derive(Debug, Clone)]
42
/// Manages adaptive brightness normalization to prevent screen flickering.
53
///

src/render/charset.rs

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -934,124 +934,6 @@ pub fn map_shape_braille(tl: f32, tr: f32, bl: f32, br: f32, threshold: f32) ->
934934
char::from_u32(0x2800 + pattern as u32).unwrap_or(' ')
935935
}
936936

937-
// ===== Shape-Vector Block Rendering =====
938-
//
939-
// Extends HalfBlock mode from brightness-only vertical fill (▁▂▃▄▅▆▇█)
940-
// to shape-aware selection from ~23 Unicode block elements including
941-
// quadrant blocks (▖▗▘▝), half blocks (▀▄▌▐), diagonals (▚▞),
942-
// and three-quarter blocks (▙▛▜▟).
943-
//
944-
// Uses the same 6D shape vector matching as ASCII mode.
945-
946-
/// Shape vector table for Unicode block element characters.
947-
///
948-
/// Each entry maps a block character to its 2×3 spatial fill pattern,
949-
/// computed from the geometric coverage of each character within the cell.
950-
/// Note: Currently unused since `map_shape_block` uses threshold-based
951-
/// quadrant matching for consistent tiling. Retained for reference.
952-
#[allow(dead_code)]
953-
const BLOCK_SHAPE_TABLE: [ShapeEntry; 23] = [
954-
// === Empty ===
955-
ShapeEntry {
956-
ch: ' ',
957-
vector: [0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
958-
},
959-
// === Vertical fill from bottom (lower block elements) ===
960-
ShapeEntry {
961-
ch: '\u{2581}',
962-
vector: [0.00, 0.00, 0.00, 0.00, 0.38, 0.38],
963-
}, // ▁ 1/8
964-
ShapeEntry {
965-
ch: '\u{2582}',
966-
vector: [0.00, 0.00, 0.00, 0.00, 0.75, 0.75],
967-
}, // ▂ 1/4
968-
ShapeEntry {
969-
ch: '\u{2583}',
970-
vector: [0.00, 0.00, 0.13, 0.13, 1.00, 1.00],
971-
}, // ▃ 3/8
972-
ShapeEntry {
973-
ch: '\u{2584}',
974-
vector: [0.00, 0.00, 0.50, 0.50, 1.00, 1.00],
975-
}, // ▄ 1/2
976-
ShapeEntry {
977-
ch: '\u{2585}',
978-
vector: [0.00, 0.00, 0.89, 0.89, 1.00, 1.00],
979-
}, // ▅ 5/8
980-
ShapeEntry {
981-
ch: '\u{2586}',
982-
vector: [0.25, 0.25, 1.00, 1.00, 1.00, 1.00],
983-
}, // ▆ 3/4
984-
ShapeEntry {
985-
ch: '\u{2587}',
986-
vector: [0.62, 0.62, 1.00, 1.00, 1.00, 1.00],
987-
}, // ▇ 7/8
988-
ShapeEntry {
989-
ch: '\u{2588}',
990-
vector: [1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
991-
}, // █ full
992-
// === Upper half + upper 1/8 ===
993-
ShapeEntry {
994-
ch: '\u{2580}',
995-
vector: [1.00, 1.00, 0.50, 0.50, 0.00, 0.00],
996-
}, // ▀ upper half
997-
ShapeEntry {
998-
ch: '\u{2594}',
999-
vector: [0.38, 0.38, 0.00, 0.00, 0.00, 0.00],
1000-
}, // ▔ upper 1/8
1001-
// === Left/right halves ===
1002-
ShapeEntry {
1003-
ch: '\u{258C}',
1004-
vector: [1.00, 0.00, 1.00, 0.00, 1.00, 0.00],
1005-
}, // ▌ left half
1006-
ShapeEntry {
1007-
ch: '\u{2590}',
1008-
vector: [0.00, 1.00, 0.00, 1.00, 0.00, 1.00],
1009-
}, // ▐ right half
1010-
// === Single quadrants ===
1011-
ShapeEntry {
1012-
ch: '\u{2598}',
1013-
vector: [1.00, 0.00, 0.50, 0.00, 0.00, 0.00],
1014-
}, // ▘ TL
1015-
ShapeEntry {
1016-
ch: '\u{259D}',
1017-
vector: [0.00, 1.00, 0.00, 0.50, 0.00, 0.00],
1018-
}, // ▝ TR
1019-
ShapeEntry {
1020-
ch: '\u{2596}',
1021-
vector: [0.00, 0.00, 0.50, 0.00, 1.00, 0.00],
1022-
}, // ▖ BL
1023-
ShapeEntry {
1024-
ch: '\u{2597}',
1025-
vector: [0.00, 0.00, 0.00, 0.50, 0.00, 1.00],
1026-
}, // ▗ BR
1027-
// === Diagonals ===
1028-
ShapeEntry {
1029-
ch: '\u{259A}',
1030-
vector: [1.00, 0.00, 0.50, 0.50, 0.00, 1.00],
1031-
}, // ▚ TL+BR
1032-
ShapeEntry {
1033-
ch: '\u{259E}',
1034-
vector: [0.00, 1.00, 0.50, 0.50, 1.00, 0.00],
1035-
}, // ▞ TR+BL
1036-
// === Three-quarter blocks ===
1037-
ShapeEntry {
1038-
ch: '\u{2599}',
1039-
vector: [1.00, 0.00, 1.00, 0.50, 1.00, 1.00],
1040-
}, // ▙ TL+BL+BR
1041-
ShapeEntry {
1042-
ch: '\u{259B}',
1043-
vector: [1.00, 1.00, 1.00, 0.50, 1.00, 0.00],
1044-
}, // ▛ TL+TR+BL
1045-
ShapeEntry {
1046-
ch: '\u{259C}',
1047-
vector: [1.00, 1.00, 0.50, 1.00, 0.00, 1.00],
1048-
}, // ▜ TL+TR+BR
1049-
ShapeEntry {
1050-
ch: '\u{259F}',
1051-
vector: [0.00, 1.00, 0.50, 1.00, 1.00, 1.00],
1052-
}, // ▟ TR+BL+BR
1053-
];
1054-
1055937
// ===== Sculpted Outline Rendering =====
1056938
//
1057939
// Used by the Sculpted charset mode for cells at the outline/edge of

src/render/downsample.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[allow(dead_code)]
21
/// A frame of downsampled simulation data, ready for rendering.
32
pub struct DownsampledFrame {
43
width: usize,
@@ -62,13 +61,11 @@ impl DownsampledFrame {
6261
}
6362
}
6463

65-
#[allow(dead_code)]
6664
/// Returns the width of the frame in cells.
6765
pub fn width(&self) -> usize {
6866
self.width
6967
}
7068

71-
#[allow(dead_code)]
7269
/// Returns the height of the frame in cells.
7370
pub fn height(&self) -> usize {
7471
self.height
@@ -79,7 +76,6 @@ impl DownsampledFrame {
7976
&self.cells
8077
}
8178

82-
#[allow(dead_code)]
8379
/// Returns the cell at the specified coordinates.
8480
pub fn get(&self, x: usize, y: usize) -> Cell {
8581
if x < self.width && y < self.height {

src/render/error_diffusion.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ mod fs_coeff {
1111
pub const DOWN_RIGHT: f32 = 1.0 / 16.0;
1212

1313
/// Coefficients for serpentine (right-to-left) scanning.
14+
/// Vertical coefficients (down, down_right) are shared with the parent module.
1415
pub mod serpentine {
1516
pub const RIGHT: f32 = 3.0 / 16.0;
1617
pub const DOWN_LEFT: f32 = 7.0 / 16.0;
17-
#[allow(dead_code)]
18-
pub const DOWN: f32 = 5.0 / 16.0;
19-
#[allow(dead_code)]
20-
pub const DOWN_RIGHT: f32 = 1.0 / 16.0;
2118
}
2219
}
2320

src/render/grid.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ impl GridRenderer {
175175
opacity.clamp(0.0, 1.0)
176176
}
177177

178-
#[allow(dead_code)]
179178
/// Blends the grid color with the underlying cell color.
180179
pub fn blend_color(
181180
&self,

src/render/options_overlay.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ impl ControlsOverlay {
4444
}
4545
}
4646

47-
#[allow(dead_code)]
4847
/// Returns the total number of categories.
4948
pub fn total_categories() -> usize {
5049
Self::TOTAL_CATEGORIES

0 commit comments

Comments
 (0)