Skip to content

Commit 3bc9345

Browse files
committed
clean up warnings
1 parent be02b27 commit 3bc9345

File tree

5 files changed

+6
-174
lines changed

5 files changed

+6
-174
lines changed

crates/qmd-syntax-helper/src/conversions/definition_lists.rs

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -181,92 +181,6 @@ impl DefinitionListConverter {
181181

182182
Ok(result)
183183
}
184-
185-
/// Process a single file
186-
pub fn process_file(
187-
&self,
188-
file_path: &Path,
189-
in_place: bool,
190-
check: bool,
191-
verbose: bool,
192-
) -> Result<()> {
193-
let content = read_file(file_path)?;
194-
let lists = self.find_definition_lists(&content);
195-
196-
if lists.is_empty() {
197-
if verbose {
198-
println!(" No definition lists found");
199-
}
200-
return Ok(());
201-
}
202-
203-
if verbose || check {
204-
println!(
205-
" Found {} definition list(s)",
206-
lists.len().to_string().yellow()
207-
);
208-
}
209-
210-
// Convert each list and build new content
211-
let mut lines: Vec<String> = content.lines().map(|s| s.to_string()).collect();
212-
let mut offset: isize = 0; // Track line offset as we modify
213-
214-
for (idx, list) in lists.iter().enumerate() {
215-
if verbose {
216-
println!(" Converting list {}...", idx + 1);
217-
}
218-
219-
let converted = self.convert_list(&list.text)?;
220-
221-
// Calculate actual line positions with offset
222-
let start = (list.start_line as isize + offset) as usize;
223-
let end = (list.end_line as isize + offset) as usize;
224-
225-
if check {
226-
println!(
227-
" List {} at lines {}-{}:",
228-
idx + 1,
229-
list.start_line,
230-
list.end_line
231-
);
232-
println!(
233-
" {} {} lines -> {} {} lines",
234-
"Original:".red(),
235-
list.end_line - list.start_line + 1,
236-
"Converted:".green(),
237-
converted.lines().count()
238-
);
239-
}
240-
241-
// Replace the list in the lines
242-
let converted_lines: Vec<String> = converted.lines().map(|s| s.to_string()).collect();
243-
let new_len = converted_lines.len();
244-
let old_len = end - start + 1;
245-
246-
// Splice in the new lines
247-
lines.splice(start..=end, converted_lines);
248-
249-
// Update offset for next list
250-
offset += new_len as isize - old_len as isize;
251-
}
252-
253-
if check {
254-
println!(" {} No changes written (--check mode)", "✓".green());
255-
return Ok(());
256-
}
257-
258-
let new_content = lines.join("\n") + "\n";
259-
260-
if in_place {
261-
write_file(file_path, &new_content)?;
262-
println!(" {} Converted {} list(s)", "✓".green(), lists.len());
263-
} else {
264-
// Output to stdout
265-
print!("{}", new_content);
266-
}
267-
268-
Ok(())
269-
}
270184
}
271185

272186
impl Rule for DefinitionListConverter {

crates/qmd-syntax-helper/src/conversions/div_whitespace.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ impl DivWhitespaceConverter {
150150
}
151151

152152
/// Process a single file
153+
#[allow(dead_code)]
153154
pub fn process_file(
154155
&self,
155156
file_path: &Path,
@@ -256,7 +257,7 @@ impl Rule for DivWhitespaceConverter {
256257
file_path: &Path,
257258
in_place: bool,
258259
check_mode: bool,
259-
verbose: bool,
260+
_verbose: bool,
260261
) -> Result<ConvertResult> {
261262
let content = read_file(file_path)?;
262263
let errors = self.get_parse_errors(file_path)?;

crates/qmd-syntax-helper/src/conversions/grid_tables.rs

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -142,92 +142,6 @@ impl GridTableConverter {
142142

143143
Ok(result)
144144
}
145-
146-
/// Process a single file
147-
pub fn process_file(
148-
&self,
149-
file_path: &Path,
150-
in_place: bool,
151-
check: bool,
152-
verbose: bool,
153-
) -> Result<()> {
154-
let content = read_file(file_path)?;
155-
let tables = self.find_grid_tables(&content);
156-
157-
if tables.is_empty() {
158-
if verbose {
159-
println!(" No grid tables found");
160-
}
161-
return Ok(());
162-
}
163-
164-
if verbose || check {
165-
println!(
166-
" Found {} grid table(s)",
167-
tables.len().to_string().yellow()
168-
);
169-
}
170-
171-
// Convert each table and build new content
172-
let mut lines: Vec<String> = content.lines().map(|s| s.to_string()).collect();
173-
let mut offset: isize = 0; // Track line offset as we modify
174-
175-
for (idx, table) in tables.iter().enumerate() {
176-
if verbose {
177-
println!(" Converting table {}...", idx + 1);
178-
}
179-
180-
let converted = self.convert_table(&table.text)?;
181-
182-
// Calculate actual line positions with offset
183-
let start = (table.start_line as isize + offset) as usize;
184-
let end = (table.end_line as isize + offset) as usize;
185-
186-
if check {
187-
println!(
188-
" Table {} at lines {}-{}:",
189-
idx + 1,
190-
table.start_line,
191-
table.end_line
192-
);
193-
println!(
194-
" {} {} lines -> {} {} lines",
195-
"Original:".red(),
196-
table.end_line - table.start_line + 1,
197-
"Converted:".green(),
198-
converted.lines().count()
199-
);
200-
}
201-
202-
// Replace the table in the lines
203-
let converted_lines: Vec<String> = converted.lines().map(|s| s.to_string()).collect();
204-
let new_len = converted_lines.len();
205-
let old_len = end - start + 1;
206-
207-
// Splice in the new lines
208-
lines.splice(start..=end, converted_lines);
209-
210-
// Update offset for next table
211-
offset += new_len as isize - old_len as isize;
212-
}
213-
214-
if check {
215-
println!(" {} No changes written (--check mode)", "✓".green());
216-
return Ok(());
217-
}
218-
219-
let new_content = lines.join("\n") + "\n";
220-
221-
if in_place {
222-
write_file(file_path, &new_content)?;
223-
println!(" {} Converted {} table(s)", "✓".green(), tables.len());
224-
} else {
225-
// Output to stdout
226-
print!("{}", new_content);
227-
}
228-
229-
Ok(())
230-
}
231145
}
232146

233147
impl Rule for GridTableConverter {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub mod syntax_check;
1+
// pub mod syntax_check; // Unused - kept for reference only

crates/qmd-syntax-helper/src/utils/resources.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,21 @@ impl ResourceManager {
5454
}
5555

5656
/// Get the temp directory path
57+
#[allow(dead_code)]
5758
pub fn temp_dir(&self) -> &Path {
5859
&self.temp_dir
5960
}
6061

6162
/// List all available resources
63+
#[allow(dead_code)]
6264
pub fn list_resources(&self) -> Vec<String> {
6365
let mut resources = Vec::new();
6466
Self::collect_files(&RESOURCES_DIR, "", &mut resources);
6567
resources
6668
}
6769

6870
/// Recursively collect all file paths from a directory
71+
#[allow(dead_code)]
6972
fn collect_files(dir: &Dir, prefix: &str, resources: &mut Vec<String>) {
7073
for file in dir.files() {
7174
let name = file.path().file_name().unwrap().to_string_lossy();

0 commit comments

Comments
 (0)