Skip to content

Commit b6501ab

Browse files
committed
ref: correct fmt
1 parent ff0fff1 commit b6501ab

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

cli/src/analyser/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ impl DiagnosticKind {
113113
| DuplicateRuntimeFunctionIdentifier { .. }
114114
| DuplicateRuntimeParameterIdentifier { .. }
115115
| GenericKeyNotInMappingTarget { .. }
116-
| EmptyGenericMapper { .. }
116+
| EmptyGenericMapper
117117
| UndefinedDataTypeIdentifier { .. }
118118
| NullField { .. }
119-
| ForbiddenVariant { .. }
119+
| ForbiddenVariant
120120
| UnusedGenericKey { .. }
121121
| UndefinedGenericKey { .. } => Severity::Error,
122122
UndefinedTranslation { .. } => Severity::Warning,

cli/src/analyser/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,26 +471,24 @@ impl Analyser {
471471
}
472472

473473
// Check if input identifier exists
474-
if let Some(identifier) = flow.input_type_identifier {
475-
if !self.data_type_identifier_exists(identifier.clone(), -1) {
474+
if let Some(identifier) = flow.input_type_identifier
475+
&& !self.data_type_identifier_exists(identifier.clone(), -1) {
476476
self.reporter.add_report(Diagnose::new(
477477
name.clone(),
478478
original_definition.clone(),
479479
UndefinedDataTypeIdentifier { identifier },
480480
));
481481
}
482-
}
483482

484483
// Check if return identifier exists
485-
if let Some(identifier) = flow.return_type_identifier {
486-
if !self.data_type_identifier_exists(identifier.clone(), -1) {
484+
if let Some(identifier) = flow.return_type_identifier
485+
&& !self.data_type_identifier_exists(identifier.clone(), -1) {
487486
self.reporter.add_report(Diagnose::new(
488487
name.clone(),
489488
original_definition.clone(),
490489
UndefinedDataTypeIdentifier { identifier },
491490
));
492491
}
493-
}
494492

495493
// Check if flow type identifier already exists
496494
for flow_type in &self.flow_types {

cli/src/command/download.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,15 @@ async fn convert_bytes_to_folder(bytes: Bytes, zip_path: &str) {
180180
panic!("Failed to create directory {}: {}", out_path.display(), e);
181181
}
182182
} else {
183-
if let Some(p) = out_path.parent() {
184-
if !p.exists() {
185-
if let Err(e) = fs::create_dir_all(p) {
183+
if let Some(p) = out_path.parent()
184+
&& !p.exists()
185+
&& let Err(e) = fs::create_dir_all(p) {
186186
panic!(
187187
"Warning: Failed to create parent directory {}: {}",
188188
p.display(),
189189
e
190190
);
191191
}
192-
}
193-
}
194192

195193
match File::create(&out_path) {
196194
Ok(mut outfile) => {

cli/src/command/feature.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ pub fn search_feature(name: Option<String>, path: Option<String>) {
2121
Some(feature_name) => parser
2222
.features
2323
.iter()
24-
.filter(|f| f.name.to_lowercase() == feature_name.to_lowercase())
25-
.map(|f| f.clone())
24+
.filter(|f| f.name.to_lowercase() == feature_name.to_lowercase()).cloned()
2625
.collect::<Vec<Feature>>(),
2726
};
2827

cli/src/command/watch.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::analyser::Analyser;
22
use crate::formatter::{default, info};
33
use notify::event::ModifyKind;
4-
use notify::{Event, EventKind, RecursiveMode, Watcher, recommended_watcher};
4+
use notify::{EventKind, RecursiveMode, Watcher, recommended_watcher};
55
use std::sync::mpsc::channel;
66
use std::time::{Duration, Instant};
77

@@ -27,16 +27,15 @@ pub async fn watch_for_changes(path: Option<String>) {
2727
loop {
2828
if let Ok(Ok(event)) = rx.recv() {
2929
match event.kind {
30-
EventKind::Modify(modify) => if let ModifyKind::Data(_) = modify {
31-
if last_run.elapsed() > Duration::from_millis(500) {
30+
EventKind::Modify(modify) => if let ModifyKind::Data(_) = modify
31+
&& last_run.elapsed() > Duration::from_millis(500) {
3232
default(String::from(
3333
"\n\n\n--------------------------------------------------------------------------\n\n",
3434
));
3535
info(String::from("Change detected! Regenerating report..."));
3636
Analyser::new(dir_path.as_str()).report(false);
3737
last_run = Instant::now();
38-
}
39-
},
38+
},
4039
EventKind::Remove(_) => {
4140
if last_run.elapsed() > Duration::from_millis(500) {
4241
default(String::from(

cli/src/formatter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ where
5555
}
5656

5757
pub fn warning(string: String, path: &String) -> String {
58-
format!("\n{}: {} {}", "warning".yellow(), string, print_path(&path))
58+
format!("\n{}: {} {}", "warning".yellow(), string, print_path(path))
5959
}
6060

6161
pub fn warning_highlight(highlight: String, string: String) {

0 commit comments

Comments
 (0)