From 140656ae0af3038e44491aef148b0ea69a4eb66a Mon Sep 17 00:00:00 2001 From: Jose Emilio Labra Gayo Date: Fri, 7 Jun 2024 12:28:00 +0200 Subject: [PATCH] Formatted more files --- dctap/src/dctap.rs | 2 +- dctap/src/lib.rs | 13 ++++++------- dctap/src/tap_config.rs | 9 +++------ dctap/src/tap_error.rs | 3 +-- dctap/src/tap_shape.rs | 10 +++------- shex_ast/src/ast/shape_expr.rs | 24 ++++++++++++++---------- shex_ast/src/ast/value_set_value.rs | 9 +++------ shex_testsuite/src/manifest_schemas.rs | 7 ++++--- 8 files changed, 35 insertions(+), 42 deletions(-) diff --git a/dctap/src/dctap.rs b/dctap/src/dctap.rs index e898d5a4..d77a0cd4 100644 --- a/dctap/src/dctap.rs +++ b/dctap/src/dctap.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use tracing::debug; #[derive(Debug, Serialize, Deserialize)] -struct TapShapeId(String); +struct TapShapeId(String); #[derive(Debug, Serialize)] pub struct DCTap { diff --git a/dctap/src/lib.rs b/dctap/src/lib.rs index 285c9f07..8c5a910c 100644 --- a/dctap/src/lib.rs +++ b/dctap/src/lib.rs @@ -6,16 +6,15 @@ //! DCTAP (Dublin Core Tabular Application Profiles) is a simple model that can be used to specify data models //! pub mod dctap; +pub mod tap_config; pub mod tap_error; -pub mod tap_statement; pub mod tap_shape; -pub mod tap_config; +pub mod tap_statement; +pub use crate::tap_config::*; pub use crate::tap_error::*; -pub use dctap::*; -pub use dctap::*; pub use crate::tap_error::*; -pub use crate::tap_statement::*; pub use crate::tap_shape::*; -pub use crate::tap_config::*; - +pub use crate::tap_statement::*; +pub use dctap::*; +pub use dctap::*; diff --git a/dctap/src/tap_config.rs b/dctap/src/tap_config.rs index 954e5a3a..1132a6a9 100644 --- a/dctap/src/tap_config.rs +++ b/dctap/src/tap_config.rs @@ -1,13 +1,10 @@ use serde_derive::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] -pub struct TapConfig { - -} +pub struct TapConfig {} impl Default for TapConfig { - fn default() -> Self { - Self { } + Self {} } -} \ No newline at end of file +} diff --git a/dctap/src/tap_error.rs b/dctap/src/tap_error.rs index 75851ca9..dff131f3 100644 --- a/dctap/src/tap_error.rs +++ b/dctap/src/tap_error.rs @@ -1,5 +1,4 @@ use thiserror::Error; #[derive(Error, Debug)] -pub enum TapError { } - +pub enum TapError {} diff --git a/dctap/src/tap_shape.rs b/dctap/src/tap_shape.rs index 46ce7905..af7da7f9 100644 --- a/dctap/src/tap_shape.rs +++ b/dctap/src/tap_shape.rs @@ -4,12 +4,8 @@ use crate::tap_statement::TapStatement; #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] pub struct TapShape { - #[serde(rename = "shapeID")] - shape_id: String, - - statements: Vec - + shape_id: String, - -} \ No newline at end of file + statements: Vec, +} diff --git a/shex_ast/src/ast/shape_expr.rs b/shex_ast/src/ast/shape_expr.rs index 6131ef1c..4667f878 100644 --- a/shex_ast/src/ast/shape_expr.rs +++ b/shex_ast/src/ast/shape_expr.rs @@ -101,9 +101,9 @@ impl ShapeExpr { pub fn or(ses: Vec) -> ShapeExpr { /*let shape_exprs = ses - .into_iter() - .map(|shape_expression| Box::new(shape_expression.into())) - .collect(); */ + .into_iter() + .map(|shape_expression| Box::new(shape_expression.into())) + .collect(); */ let mut shape_exprs = Vec::new(); for se in ses { shape_exprs.push(se.into()) @@ -113,9 +113,9 @@ impl ShapeExpr { pub fn and(ses: Vec) -> ShapeExpr { /* let shape_exprs = ses - .into_iter() - .map(|shape_expression| Box::new(shape_expression.into())) - .collect(); */ + .into_iter() + .map(|shape_expression| Box::new(shape_expression.into())) + .collect(); */ let mut shape_exprs = Vec::new(); for se in ses { shape_exprs.push(se.into()) @@ -160,12 +160,16 @@ impl Deref for ShapeExpr { ShapeExpr::External => Ok(ShapeExpr::External), ShapeExpr::ShapeAnd { shape_exprs } => { let shape_exprs = ::deref_vec(shape_exprs, base, prefixmap)?; - Ok(ShapeExpr::ShapeAnd { shape_exprs: shape_exprs.clone() }) - }, + Ok(ShapeExpr::ShapeAnd { + shape_exprs: shape_exprs.clone(), + }) + } ShapeExpr::ShapeOr { shape_exprs } => { let shape_exprs = ::deref_vec(shape_exprs, base, prefixmap)?; - Ok(ShapeExpr::ShapeOr { shape_exprs: shape_exprs.clone() }) - }, + Ok(ShapeExpr::ShapeOr { + shape_exprs: shape_exprs.clone(), + }) + } ShapeExpr::ShapeNot { shape_expr } => { let shape_expr = Box::new(shape_expr.deref(base, prefixmap)?); Ok(ShapeExpr::ShapeNot { shape_expr }) diff --git a/shex_ast/src/ast/value_set_value.rs b/shex_ast/src/ast/value_set_value.rs index 7a434d81..91dc9e2c 100644 --- a/shex_ast/src/ast/value_set_value.rs +++ b/shex_ast/src/ast/value_set_value.rs @@ -728,8 +728,7 @@ impl<'de> Deserialize<'de> for ValueSetValue { } None => Err(de::Error::missing_field("value")), }, - Some(ValueSetValueType::Integer) => { - match value { + Some(ValueSetValueType::Integer) => match value { Some(s) => { let n = isize::from_str(&s).map_err(|e| { de::Error::custom(format!( @@ -740,7 +739,7 @@ impl<'de> Deserialize<'de> for ValueSetValue { Ok(v) } None => Err(de::Error::missing_field("value")), - }}, + }, Some(ValueSetValueType::Other(iri)) => match value { Some(v) => match language_tag { Some(lang) => Ok(ValueSetValue::ObjectValue(ObjectValue::Literal( @@ -749,9 +748,7 @@ impl<'de> Deserialize<'de> for ValueSetValue { lang: Some(Lang::new(&lang)), }, ))), - None => { - Ok(ValueSetValue::datatype_literal(&v, &iri)) - }, + None => Ok(ValueSetValue::datatype_literal(&v, &iri)), }, None => Err(de::Error::missing_field("value")), }, diff --git a/shex_testsuite/src/manifest_schemas.rs b/shex_testsuite/src/manifest_schemas.rs index 4d866f79..d370774a 100644 --- a/shex_testsuite/src/manifest_schemas.rs +++ b/shex_testsuite/src/manifest_schemas.rs @@ -175,12 +175,13 @@ impl SchemasEntry { } })?; - let schema_serialized_after = serde_json::to_string_pretty(&schema_parsed_after_serialization).map_err(|e| { + let schema_serialized_after = + serde_json::to_string_pretty(&schema_parsed_after_serialization).map_err(|e| { ManifestError::SchemaSerializationError2nd { schema_parsed: schema_parsed_after_serialization.clone(), error: e, } - })?; + })?; if schema_parsed == schema_parsed_after_serialization { // If the 2 schemas are equal, parse the corresponding schema using ShExC and check that it is also equal @@ -216,7 +217,7 @@ impl SchemasEntry { schema_parsed, schema_serialized: schema_serialized.clone(), schema_parsed_after_serialization, - schema_serialized_after + schema_serialized_after, }) } }