Skip to content

Commit 6d6d1a5

Browse files
Clean build - removed compiler warnings
1 parent 3831660 commit 6d6d1a5

10 files changed

Lines changed: 35 additions & 6 deletions

File tree

src/commands/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::path::PathBuf;
22

3+
#[allow(dead_code)]
34
pub fn main(input: PathBuf) -> anyhow::Result<()> {
45
let _ = input;
56
println!("(ast) placeholder: showing AST...");

src/commands/compile.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::core::diagnostics::{print_error, Span};
1010
use crate::core::lexer::{Lexer, LexerError};
1111
use crate::core::parser::{Parser as AeParser, ParserError};
1212

13+
#[allow(dead_code)]
1314
pub fn main_with_opts(
1415
input: PathBuf,
1516
emit: EmitKind,

src/commands/format.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::path::PathBuf;
22

3+
#[allow(dead_code)]
34
pub fn main_with_opts(inputs: Vec<PathBuf>, check: bool) -> anyhow::Result<()> {
45
let _ = (inputs, check);
56
println!("(format) placeholder: formatting...");

src/commands/lint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::path::PathBuf;
22

3+
#[allow(dead_code)]
34
pub fn main_with_opts(inputs: Vec<PathBuf>, fix: bool) -> anyhow::Result<()> {
45
let _ = (inputs, fix);
56
println!("(lint) placeholder: linting...");

src/commands/tokens.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::path::PathBuf;
22

3+
#[allow(dead_code)]
34
pub fn main(input: PathBuf) -> anyhow::Result<()> {
45
let _ = input;
56
println!("(tokens) placeholder: showing tokens...");

src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn resolve_config_path(cli_path: &Option<PathBuf>) -> Option<PathBuf> {
1313
default_config_path()
1414
}
1515

16+
#[allow(dead_code)]
1617
pub fn ensure_parent_dir(path: &Path) -> Result<()> {
1718
if let Some(parent) = path.parent() {
1819
std::fs::create_dir_all(parent)

src/core/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ pub enum ASTNode {
7777
},
7878

7979
// Special
80+
#[allow(dead_code)]
8081
Error(String),
8182
}
8283

src/core/compiler.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl Compiler {
2121
pub fn new() -> Self { Compiler }
2222

2323
/// Back-compat: default to running semantic analysis.
24+
#[allow(dead_code)]
2425
pub fn compile(&self, code: &str, output_file: &str) -> Result<(), CoreError> {
2526
self.compile_with(code, output_file, true)
2627
}
@@ -66,9 +67,9 @@ impl Compiler {
6667

6768
// 6) Write file
6869
let mut file = File::create(output_file)
69-
.map_err(|e| CoreError::general_error(&format!("Failed to create output file: {}", e)))?;
70+
.map_err(|e| CoreError::io_error(&format!("Failed to create output file: {}", e)))?;
7071
file.write_all(output_code.as_bytes())
71-
.map_err(|e| CoreError::general_error(&format!("Failed to write to output file: {}", e)))?;
72+
.map_err(|e| CoreError::io_error(&format!("Failed to write to output file: {}", e)))?;
7273

7374
println!("Compilation successful. Output written to '{}'.", output_file);
7475
Ok(())
@@ -77,7 +78,7 @@ impl Compiler {
7778
/// Validates code before compilation
7879
pub fn validate_and_summarize(&self, code: &str) -> Result<String, CoreError> {
7980
if code.trim().is_empty() {
80-
return Err(CoreError::general_error("Code is empty. Nothing to compile."));
81+
return Err(CoreError::invalid_operation("No source code provided"));
8182
}
8283
let lines = code.lines().count();
8384
let chars = code.chars().count();

src/core/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::fmt;
22

33
#[derive(Debug)]
4+
#[allow(dead_code)]
45
pub enum CoreError {
56
InterpretationError(String),
67
IoError(String),
@@ -22,6 +23,7 @@ impl fmt::Display for CoreError {
2223
impl std::error::Error for CoreError {}
2324

2425
impl CoreError {
26+
#[allow(dead_code)]
2527
pub fn interpretation(message: &str) -> Self { CoreError::InterpretationError(message.to_string()) }
2628
pub fn io_error(message: &str) -> Self { CoreError::IoError(message.to_string()) }
2729
pub fn invalid_operation(message: &str) -> Self { CoreError::InvalidOperation(message.to_string()) }

src/tui/editor.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,29 @@ fn neon() -> (Color, Color, Color, Color) {
3838

3939
#[derive(Copy, Clone)]
4040
enum EmitMode { Js, Ai }
41+
4142
impl EmitMode {
42-
fn toggle(self) -> Self { match self { EmitMode::Js => EmitMode::Ai, EmitMode::Ai => EmitMode::Js } }
43-
fn label(self) -> &'static str { match self { EmitMode::Js => "JS", EmitMode::Ai => "AI" } }
44-
fn to_emit_kind(self) -> EmitKind { match self { EmitMode::Js => EmitKind::Js, EmitMode::Ai => EmitKind::Ai } }
43+
fn toggle(self) -> Self {
44+
match self {
45+
EmitMode::Js => EmitMode::Ai,
46+
EmitMode::Ai => EmitMode::Js,
47+
}
48+
}
49+
50+
fn label(self) -> &'static str {
51+
match self {
52+
EmitMode::Js => "JS",
53+
EmitMode::Ai => "AI",
54+
}
55+
}
56+
57+
#[allow(dead_code)]
58+
fn to_emit_kind(self) -> EmitKind {
59+
match self {
60+
EmitMode::Js => EmitKind::Js,
61+
EmitMode::Ai => EmitKind::Ai,
62+
}
63+
}
4564
}
4665

4766
struct App {

0 commit comments

Comments
 (0)