Skip to content

Commit

Permalink
Fix clippy and bump fastn-resolved version
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Nov 20, 2024
1 parent 7dd33fc commit 17b7ebc
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions fastn-resolved-to-js/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum Element {
Boolean(Boolean),
Column(Column),
Row(Row),
ContainerElement(ContainerElement),
Container(ContainerElement),
Image(Image),
Audio(Audio),
Video(Video),
Expand All @@ -35,7 +35,7 @@ impl Element {
"ftd#boolean" => Element::Boolean(Boolean::from(component)),
"ftd#column" => Element::Column(Column::from(component)),
"ftd#row" => Element::Row(Row::from(component)),
"ftd#container" => Element::ContainerElement(ContainerElement::from(component)),
"ftd#container" => Element::Container(ContainerElement::from(component)),
"ftd#image" => Element::Image(Image::from(component)),
"ftd#video" => Element::Video(Video::from(component)),
"ftd#audio" => Element::Audio(Audio::from(component)),
Expand Down Expand Up @@ -99,7 +99,7 @@ impl Element {
should_return,
has_rive_components,
),
Element::ContainerElement(container) => container.to_component_statements(
Element::Container(container) => container.to_component_statements(
parent,
index,
doc,
Expand Down Expand Up @@ -2232,6 +2232,7 @@ impl TextCommon {
}

#[derive(Debug)]
#[allow(dead_code)]
pub struct Rive {
pub src: fastn_resolved_to_js::Value,
pub canvas_width: Option<fastn_resolved_to_js::Value>,
Expand Down
2 changes: 0 additions & 2 deletions fastn-resolved-to-js/src/fastn_type_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ impl ValueExt for fastn_resolved::Value {
variant,
full_variant,
value,
doc.name(),
value.line_number(),
);
if has_value {
return fastn_js::SetPropertyValue::Value(fastn_js::Value::OrType {
Expand Down
4 changes: 0 additions & 4 deletions fastn-resolved-to-js/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ pub(crate) fn to_key(key: &str) -> String {
.to_string()
}

pub(crate) fn update_reference_with_none(reference: &str) -> String {
update_reference(reference, &fastn_resolved_to_js::ResolverData::none())
}

pub(crate) fn update_reference(
reference: &str,
rdata: &fastn_resolved_to_js::ResolverData,
Expand Down
27 changes: 0 additions & 27 deletions fastn-resolved-to-js/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ pub struct ReferenceData {
}

impl Value {
pub(crate) fn to_set_property_value_with_none(
&self,
doc: &dyn fastn_resolved::tdoc::TDoc,
has_rive_components: &mut bool,
) -> fastn_js::SetPropertyValue {
self.to_set_property_value_with_ui(
doc,
&fastn_resolved_to_js::ResolverData::none(),
has_rive_components,
false,
)
}

pub(crate) fn to_set_property_value(
&self,
doc: &dyn fastn_resolved::tdoc::TDoc,
Expand Down Expand Up @@ -61,8 +48,6 @@ impl Value {
variant.as_str(),
full_variant.as_str(),
value,
doc.name(),
value.line_number(),
);

// return or-type value with reference
Expand Down Expand Up @@ -228,7 +213,6 @@ impl ExpressionExt for fastn_resolved::Expression {

pub(crate) trait ArgumentExt {
fn get_default_value(&self) -> Option<fastn_resolved_to_js::Value>;
fn get_value(&self, properties: &[fastn_resolved::Property]) -> fastn_resolved_to_js::Value;
fn get_optional_value(
&self,
properties: &[fastn_resolved::Property],
Expand Down Expand Up @@ -261,15 +245,6 @@ impl ArgumentExt for fastn_resolved::Argument {
None
}
}
fn get_value(&self, properties: &[fastn_resolved::Property]) -> fastn_resolved_to_js::Value {
if let Some(value) = self.get_optional_value(properties) {
value
} else if let Some(value) = self.get_default_value() {
value
} else {
panic!("{}", format!("Expected value for argument: {:?}", &self))
}
}

fn get_optional_value(
&self,
Expand Down Expand Up @@ -327,8 +302,6 @@ pub(crate) fn ftd_to_js_variant(
variant: &str,
full_variant: &str,
value: &fastn_resolved::PropertyValue,
doc_id: &str,
line_number: usize,
) -> (String, bool) {
// returns (JSVariant, has_value)
let variant = variant
Expand Down
2 changes: 1 addition & 1 deletion fastn-resolved/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fastn-resolved"
version = "0.1.0"
version = "0.1.1"
authors.workspace = true
edition.workspace = true
description.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn default_bag_into_js_ast() -> Vec<fastn_js::Ast> {
let doc = ftd::interpreter::TDoc {
name: "",
aliases: &ftd::interpreter::default::default_aliases(),
bag: ftd::interpreter::BagOrState::Bag(&bag),
bag: ftd::interpreter::BagOrState::Bag(bag),
};
let mut export_asts = vec![];
for thing in ftd::interpreter::default::get_default_bag().values() {
Expand Down
1 change: 1 addition & 0 deletions v0.5/fastn-compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern crate self as fastn_compiler;
mod compiler;
mod js;
mod symbols;
mod tdoc;
mod utils;

pub use compiler::compile;
Expand Down
4 changes: 4 additions & 0 deletions v0.5/fastn-compiler/src/tdoc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub struct TDoc {
bag: indexmap::IndexMap<String, fastn_resolved::Definition>,
}

0 comments on commit 17b7ebc

Please sign in to comment.