Skip to content

Commit 95ac8d0

Browse files
committed
fix: format error
1 parent 50f4eba commit 95ac8d0

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

crates/driver/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn init_ingot(db: &mut DriverDataBase, ingot_url: &Url) -> Vec<IngotInitDiag
4242
// Root ingot resolution should never fail since directory existence is validated earlier.
4343
// If it fails, it indicates a bug in the resolver or an unexpected system condition.
4444
if let Err(err) = ingot_graph_resolver.graph_resolve(&mut handler, ingot_url) {
45-
panic!("Unexpected failure resolving root ingot at {}: {:?}. This indicates a bug in the resolver since directory existence is validated before calling init_ingot.", ingot_url, err);
45+
panic!("Unexpected failure resolving root ingot at {ingot_url}: {err:?}. This indicates a bug in the resolver since directory existence is validated before calling init_ingot.");
4646
}
4747

4848
// Collect diagnostics from all sources
@@ -92,7 +92,7 @@ pub fn init_ingot(db: &mut DriverDataBase, ingot_url: &Url) -> Vec<IngotInitDiag
9292
.node_indices()
9393
.any(|idx| cyclic_subgraph[idx] == *ingot_url)
9494
{
95-
panic!("Root ingot {} not found in cyclic subgraph. This indicates a bug in cycle detection logic.", ingot_url);
95+
panic!("Root ingot {ingot_url} not found in cyclic subgraph. This indicates a bug in cycle detection logic.");
9696
}
9797
let tree_root = ingot_url.clone();
9898

@@ -157,8 +157,7 @@ impl std::fmt::Display for IngotInitDiagnostics {
157157
IngotInitDiagnostics::IngotDependencyCycle { tree_display } => {
158158
write!(
159159
f,
160-
"Detected cycle(s) in ingot dependencies:\n\n{}",
161-
tree_display
160+
"Detected cycle(s) in ingot dependencies:\n\n{tree_display}"
162161
)
163162
}
164163
IngotInitDiagnostics::FileError { diagnostic } => {

crates/fe/src/check.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ fn check_ingot(db: &mut DriverDataBase, dir_path: &Utf8PathBuf) -> bool {
6565
let canonical_path = match dir_path.canonicalize_utf8() {
6666
Ok(path) => path,
6767
Err(_) => {
68-
eprintln!(
69-
"Error: Invalid or non-existent directory path: {}",
70-
dir_path
71-
);
68+
eprintln!("Error: Invalid or non-existent directory path: {dir_path}");
7269
eprintln!(" Make sure the directory exists and is accessible");
7370
return true;
7471
}
@@ -77,7 +74,7 @@ fn check_ingot(db: &mut DriverDataBase, dir_path: &Utf8PathBuf) -> bool {
7774
let ingot_url = match Url::from_directory_path(canonical_path.as_str()) {
7875
Ok(url) => url,
7976
Err(_) => {
80-
eprintln!("❌ Error: Invalid directory path: {}", dir_path);
77+
eprintln!("❌ Error: Invalid directory path: {dir_path}");
8178
return true;
8279
}
8380
};
@@ -107,7 +104,7 @@ fn check_ingot(db: &mut DriverDataBase, dir_path: &Utf8PathBuf) -> bool {
107104

108105
if db.workspace().get(db, &config_url).is_none() {
109106
eprintln!("❌ Error: No fe.toml file found in the root directory");
110-
eprintln!(" Expected fe.toml at: {}", config_url);
107+
eprintln!(" Expected fe.toml at: {config_url}");
111108
eprintln!(
112109
" Make sure you're in an fe project directory or create a fe.toml file"
113110
);

crates/fe/src/tree.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ pub fn print_tree(path: &Utf8PathBuf) {
1616
let canonical_path = match path.canonicalize_utf8() {
1717
Ok(path) => path,
1818
Err(_) => {
19-
eprintln!("Error: Invalid or non-existent directory path: {}", path);
19+
eprintln!("Error: Invalid or non-existent directory path: {path}");
2020
return;
2121
}
2222
};
2323

2424
let ingot_url = match Url::from_directory_path(canonical_path.as_str()) {
2525
Ok(url) => url,
2626
Err(_) => {
27-
eprintln!("Error: Invalid directory path: {}", path);
27+
eprintln!("Error: Invalid directory path: {path}");
2828
return;
2929
}
3030
};
@@ -41,11 +41,11 @@ pub fn print_tree(path: &Utf8PathBuf) {
4141

4242
// Print files resolver diagnostics
4343
for diagnostic in resolver.node_resolver.take_diagnostics() {
44-
eprintln!("❌ File resolution error: {}", diagnostic);
44+
eprintln!("❌ File resolution error: {diagnostic}");
4545
}
4646

4747
// Print the tree
48-
print!("{}", tree_output);
48+
print!("{tree_output}");
4949
}
5050
Err(err) => {
5151
// Print diagnostics even on failure
@@ -57,7 +57,7 @@ pub fn print_tree(path: &Utf8PathBuf) {
5757
}
5858

5959
for diagnostic in resolver.node_resolver.take_diagnostics() {
60-
eprintln!("❌ File resolution error: {}", diagnostic);
60+
eprintln!("❌ File resolution error: {diagnostic}");
6161
}
6262

6363
println!("❌ Failed to resolve dependency tree: {err}");
@@ -96,10 +96,7 @@ impl ResolutionHandler<FilesResolver> for TreeHandler {
9696

9797
// Report config validation diagnostics
9898
for diagnostic in &config.diagnostics {
99-
eprintln!(
100-
"❌ Config validation error at {}: {}",
101-
ingot_url, diagnostic
102-
);
99+
eprintln!("❌ Config validation error at {ingot_url}: {diagnostic}");
103100
}
104101

105102
self.configs.insert(ingot_url.clone(), config.clone());
@@ -111,7 +108,7 @@ impl ResolutionHandler<FilesResolver> for TreeHandler {
111108
}
112109
Err(err) => {
113110
tracing::warn!(target: "resolver", "Failed to parse config for ingot {}: {}", ingot_url, err);
114-
eprintln!("❌ Invalid fe.toml file at {}: {}", ingot_url, err);
111+
eprintln!("❌ Invalid fe.toml file at {ingot_url}: {err}");
115112
vec![]
116113
}
117114
}

crates/resolver/src/files.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ impl fmt::Display for FilesResolutionDiagnostic {
9494
write!(f, "Missing required file '{path}' in ingot at {url}")
9595
}
9696
FilesResolutionDiagnostic::RequiredDirectoryMissing(url, path) => {
97-
write!(
98-
f,
99-
"Missing required directory '{path}' in ingot at {url}"
100-
)
97+
write!(f, "Missing required directory '{path}' in ingot at {url}")
10198
}
10299
}
103100
}

0 commit comments

Comments
 (0)