Skip to content

Commit aabad7f

Browse files
committed
ref: cargo fmt
1 parent 730eb99 commit aabad7f

File tree

7 files changed

+24
-23
lines changed

7 files changed

+24
-23
lines changed

crates/cli/src/analyser/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::formatter::{error, warning};
2+
use crate::parser::Meta;
23
use std::cmp::PartialEq;
34
use std::path::Path;
45
use std::process::exit;
5-
use crate::parser::Meta;
66

77
#[derive(Default)]
88
pub struct Reporter {

crates/cli/src/analyser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use crate::analyser::diagnostics::DiagnosticKind::{
66
UndefinedGenericKey, UndefinedTranslation, UnusedGenericKey,
77
};
88
use crate::analyser::diagnostics::{Diagnose, DiagnosticKind, Reporter};
9+
use crate::parser::Parser;
10+
use crate::parser::{Meta, MetaType, Reader};
911
use tucana::shared::data_type_identifier::Type;
1012
use tucana::shared::definition_data_type_rule::Config;
1113
use tucana::shared::{DataTypeIdentifier, DefinitionDataType, FlowType, RuntimeFunctionDefinition};
12-
use crate::parser::Parser;
13-
use crate::parser::{Meta, MetaType, Reader};
1414

1515
#[derive(Clone)]
1616
pub struct AnalysableDataType {

crates/cli/src/command/bundle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
use crate::parser::Parser;
12
use prost::Message;
23
use std::fs;
34
use std::io::Write;
4-
use crate::parser::Parser;
55

66
pub fn bundle(path: Option<String>, out: Option<String>) {
77
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());

crates/cli/src/command/definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::formatter::{info, success};
2-
use colored::Colorize;
32
use crate::parser::Parser;
3+
use colored::Colorize;
44

55
pub fn search_definition(name: String, path: Option<String>) {
66
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());

crates/cli/src/parser.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use serde::Serialize;
2-
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
32
use std::io::ErrorKind;
43
use std::{
54
fs::{self, DirEntry},
65
io::Error,
76
path::Path,
87
};
8+
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
99

1010
#[derive(Serialize, Clone, Debug)]
1111
pub struct DefinitionError {
@@ -128,7 +128,6 @@ impl Parser {
128128
}
129129
}
130130

131-
132131
#[derive(Serialize, Debug, Clone, Copy)]
133132
pub enum MetaType {
134133
FlowType,
@@ -291,4 +290,3 @@ fn get_file_name(entry: &DirEntry) -> Option<String> {
291290
.to_str()
292291
.map(|file_name| file_name.to_string())
293292
}
294-

crates/cli/src/table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use crate::parser::Feature;
12
use tabled::Tabled;
23
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
3-
use crate::parser::Feature;
44

55
#[derive(Tabled)]
66
pub struct FlowTypeRow {

crates/package/src/lib.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
pub mod package {
22
use serde::Serialize;
3-
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
43
use std::io::ErrorKind;
54
use std::{
65
fs::{self, DirEntry},
76
io::Error,
87
path::Path,
98
};
9+
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
1010

1111
#[derive(Serialize, Clone, Debug)]
1212
pub struct DefinitionError {
@@ -96,14 +96,16 @@ pub mod package {
9696
fn append_meta(feature: &mut Feature, meta: &Meta) {
9797
let definition = meta.definition_string.as_str();
9898
match meta.r#type {
99-
MetaType::DataType => match serde_json::from_str::<DefinitionDataType>(definition) {
100-
Ok(data_type) => feature.data_types.push(data_type),
101-
Err(err) => feature.errors.push(DefinitionError {
102-
definition: Parser::extract_identifier(definition, MetaType::DataType),
103-
definition_type: MetaType::DataType,
104-
error: err.to_string(),
105-
}),
106-
},
99+
MetaType::DataType => {
100+
match serde_json::from_str::<DefinitionDataType>(definition) {
101+
Ok(data_type) => feature.data_types.push(data_type),
102+
Err(err) => feature.errors.push(DefinitionError {
103+
definition: Parser::extract_identifier(definition, MetaType::DataType),
104+
definition_type: MetaType::DataType,
105+
error: err.to_string(),
106+
}),
107+
}
108+
}
107109
MetaType::FlowType => match serde_json::from_str::<FlowType>(definition) {
108110
Ok(flow_type) => feature.flow_types.push(flow_type),
109111
Err(err) => feature.errors.push(DefinitionError {
@@ -129,7 +131,6 @@ pub mod package {
129131
}
130132
}
131133

132-
133134
#[derive(Serialize, Debug, Clone, Copy)]
134135
pub enum MetaType {
135136
FlowType,
@@ -160,7 +161,11 @@ pub mod package {
160161
}
161162

162163
impl Meta {
163-
pub fn read_from_file<P>(name: String, r#type: MetaType, file_path: P) -> Result<Meta, Error>
164+
pub fn read_from_file<P>(
165+
name: String,
166+
r#type: MetaType,
167+
file_path: P,
168+
) -> Result<Meta, Error>
164169
where
165170
P: AsRef<Path>,
166171
{
@@ -292,6 +297,4 @@ pub mod package {
292297
.to_str()
293298
.map(|file_name| file_name.to_string())
294299
}
295-
296-
297-
}
300+
}

0 commit comments

Comments
 (0)