Skip to content

Commit

Permalink
Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel committed Nov 29, 2023
1 parent a8e8b8f commit 8ad6cb3
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 37 deletions.
4 changes: 1 addition & 3 deletions rs/src/output/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ impl From<jsonschema::error::ValidationError<'_>> for Message {
strum_macros::EnumIter,
strum_macros::EnumProperty,
num_derive::FromPrimitive,
Default,
)]
#[derive(Default)]
pub enum Classification {
// Unclassified diagnostics (group 0).
#[strum(props(HiddenDescription = "unclassified diagnostic"))]
Expand Down Expand Up @@ -370,8 +370,6 @@ pub enum Classification {
RedundantEnumVariant = 7008,
}



impl Classification {
/// Returns the complete code for this classification.
pub fn code(&self) -> u32 {
Expand Down
5 changes: 1 addition & 4 deletions rs/src/output/type_system/data/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ pub trait ParameterInfo {
}

/// Type class.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
pub enum Class {
/// Unresolved type. Used for error recovery.
#[default]
Expand All @@ -55,8 +54,6 @@ pub enum Class {
UserDefined(extension::simple::type_class::Reference),
}



impl std::fmt::Display for Class {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
5 changes: 1 addition & 4 deletions rs/src/output/type_system/data/variation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use crate::output::extension;

/// A type variation.
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub enum Variation {
/// The special system-preferred variation, also known as \[0\].
#[default]
Expand All @@ -16,8 +15,6 @@ pub enum Variation {
UserDefined(extension::simple::type_variation::Reference),
}



impl std::fmt::Display for Variation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
2 changes: 0 additions & 2 deletions rs/src/output/type_system/meta/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ pub enum Function {
IfThenElse,
}



impl Function {
/// Evaluates this function.
pub fn evaluate(
Expand Down
5 changes: 1 addition & 4 deletions rs/src/output/type_system/meta/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ pub trait Pattern {
/// it acts like an expression and is evaluated; see [Pattern::evaluate()]
/// and [Pattern::evaluate_with_context()]. This either fails or yields a
/// [meta::Value].
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub enum Value {
/// Used when a pattern is unknown due to validator-specific error
/// recovery. Matches all values, and evaluates to an unresolved value.
Expand Down Expand Up @@ -163,8 +162,6 @@ impl std::fmt::Display for Value {
}
}



impl Value {
/// Match the given value without being lenient about unresolved values.
/// Whenever this returns false, the public match_pattern_with_context()
Expand Down
5 changes: 1 addition & 4 deletions rs/src/output/type_system/meta/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
///
/// Note that the meta type system is much simpler than the data type system,
/// and cannot be extended.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Default)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
pub enum Type {
/// Special validator-specific value used when the type is unknown due to
/// recovery from previous errors.
Expand Down Expand Up @@ -54,5 +53,3 @@ impl std::fmt::Display for Type {
}
}
}


5 changes: 1 addition & 4 deletions rs/src/output/type_system/meta/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use crate::util;
use crate::util::string::Describe;

/// The value enumeration for metatypes ([`meta::Type`]).
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub enum Value {
/// Special validator-specific value used when the value is unknown due to
/// recovery from previous errors.
Expand Down Expand Up @@ -58,8 +57,6 @@ impl std::fmt::Display for Value {
}
}



impl From<bool> for Value {
fn from(x: bool) -> Self {
Value::Boolean(x)
Expand Down
5 changes: 1 addition & 4 deletions rs/src/parse/expressions/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ pub enum FunctionType {
}

/// A function argument; either a value, a type, or an enum option.
#[derive(Clone, Debug, PartialEq)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Default)]
pub enum FunctionArgument {
/// Used when a function argument is so malformed that not even the type of
/// argument is known.
Expand All @@ -47,8 +46,6 @@ pub enum FunctionArgument {
Enum(String),
}



impl Describe for FunctionArgument {
fn describe(
&self,
Expand Down
5 changes: 1 addition & 4 deletions rs/src/parse/expressions/literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use crate::util::string::Describe;
use std::sync::Arc;

/// The value of a literal, not including type information.
#[derive(Clone, Debug, PartialEq)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Default)]
enum LiteralValue {
/// May be used for any nullable type.
#[default]
Expand Down Expand Up @@ -52,8 +51,6 @@ enum LiteralValue {
UserDefined,
}



/// A complete literal, including type information.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Literal {
Expand Down
66 changes: 66 additions & 0 deletions rs/src/parse/expressions/nested.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
use crate::{
input::proto::substrait,
output::{diagnostic, extension},
parse::{context, expressions, extensions},
};

#[derive(Clone, Debug, PartialEq)]
pub struct Nested {
nullable: bool,
// type_variation_reference: extension::simple::type_variation::ResolutionResult,
}

fn parse_struct(
x: &substrait::expression::nested::Struct,
y: &mut context::Context,
nullable: bool,
variants: Option<extension::simple::type_variation::ResolutionResult>,
) -> diagnostic::Result<expressions::Expression> {
let fields = proto_repeated_field!(x, y, fields);
todo!()
}

fn parse_nested_type(
x: &substrait::expression::nested::NestedType,
y: &mut context::Context,
nullable: bool,
variants: Option<extension::simple::type_variation::ResolutionResult>,
) -> diagnostic::Result<expressions::Expression> {
match x {
substrait::expression::nested::NestedType::Struct(r#struct) => {
parse_struct(r#struct, y, nullable);
}
substrait::expression::nested::NestedType::List(list) => {}
substrait::expression::nested::NestedType::Map(map) => {}
}
todo!()
}

/// Parse a nested type constructor expression
pub fn parse_nested(
x: &substrait::expression::Nested,
y: &mut context::Context,
) -> diagnostic::Result<expressions::Expression> {
let nullable = proto_primitive_field!(x, y, nullable).1.unwrap_or_default();
let type_variation_reference = proto_primitive_field!(
x,
y,
type_variation_reference,
extensions::simple::parse_type_variation_reference_without_class
)
.1
.unwrap_or_default();
let nested_type = proto_required_field!(
x,
y,
nested_type,
parse_nested_type,
x.nullable,
type_variation_reference
);
let nested = Nested {
nullable,
// type_variation_reference,
};
Ok(super::Expression::Nested(Box::new(nested)))
}
5 changes: 1 addition & 4 deletions rs/src/parse/expressions/references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ pub mod mask;
pub mod scalar;

/// Description of the root of a reference.
#[derive(Clone, Debug, PartialEq)]
#[derive(Default)]
#[derive(Clone, Debug, PartialEq, Default)]
enum Root {
#[default]
Unresolved,
Expand All @@ -31,8 +30,6 @@ impl From<expressions::Expression> for Root {
}
}



/// Description of a reference path.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ReferencePath {
Expand Down

0 comments on commit 8ad6cb3

Please sign in to comment.