Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Frizi committed May 15, 2023
1 parent 6915090 commit a08f7ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/gui/language/span-tree/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ mod test {
/// cleaner the expression IDs are removed before comparing trees.
fn clear_expression_ids<T>(node: &mut Node<T>) {
node.ast_id = None;
node.extended_ast_id = None;
for child in &mut node.children {
clear_expression_ids(&mut child.node);
}
Expand Down
14 changes: 7 additions & 7 deletions app/gui/view/graph-editor/src/component/node/input/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl Configuration {

let usage_type = info.usage_type.as_ref().map(|t| t.as_str());
let decl_type = kind.tp().map(|t| t.as_str());
let decl_or_usage = decl_type.or_else(|| usage_type);
let decl_or_usage = decl_type.or(usage_type);

let first_decl_is_vector =
|| decl_type.map_or(false, |t| t.starts_with(list_editor::VECTOR_TYPE));
Expand All @@ -330,14 +330,14 @@ impl Configuration {
(Kind::Argument(_) | Kind::InsertionPoint(_), Some(tags))
if (allow(F::SingleChoice) || prefer_list) =>
Self::static_dropdown(kind.name().as_ref().map(Into::into), tags)
.as_list_item_if(prefer_list, decl_or_usage, first_tag),
.into_list_item_if(prefer_list, decl_or_usage, first_tag),

(Kind::Root | Kind::Argument(_), _) if allows_list =>
Self::list_editor(None, decl_or_usage, first_tag),

(Kind::InsertionPoint(p), _)
if p.kind.is_expected_argument() && (allow(F::Label) || prefer_list) =>
Self::always(label::Config::default()).as_list_item_if(
Self::always(label::Config::default()).into_list_item_if(
prefer_list,
decl_or_usage,
first_tag,
Expand Down Expand Up @@ -385,20 +385,20 @@ impl Configuration {
Self::always(single_choice::Config { label, entries })
}

fn as_list_item_if(
fn into_list_item_if(
self,
condition: bool,
typename: Option<&str>,
default_tag: Option<&TagValue>,
) -> Self {
if condition {
self.as_list_item(typename, default_tag)
self.into_list_item(typename, default_tag)
} else {
self
}
}

fn as_list_item(self, typename: Option<&str>, default_tag: Option<&TagValue>) -> Self {
fn into_list_item(self, typename: Option<&str>, default_tag: Option<&TagValue>) -> Self {
Self::list_editor(Some(Rc::new(self)), typename, default_tag)
}

Expand All @@ -415,7 +415,7 @@ impl Configuration {
let item_default = match default_tag {
Some(tag) => list_editor::DefaultValue::Tag(tag.clone()),
None => list_editor::DefaultValue::StaticExpression(
list_editor::infer_default_value_from_type(typename).into(),
list_editor::infer_default_value_from_type(typename),
),
};
Self::always(list_editor::Config { item_widget, item_default })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl Model {
}

let element = entry.or_insert_with(Element::new);
set_insertion_margins(&*insert, -ITEMS_GAP * 0.5);
set_insertion_margins(&insert, -ITEMS_GAP * 0.5);
element.alive = Some(());
element.item_crumb = index;
element.expr_range = range;
Expand Down Expand Up @@ -482,7 +482,7 @@ impl Model {
let (mut expression, import) = match &self.default_value {
DefaultValue::Tag(tag) => (
tag.expression.clone().into(),
tag.required_import.as_ref().map(|i| ImString::from(i)),
tag.required_import.as_ref().map(ImString::from),
),
DefaultValue::Expression(expr) => (expr.clone(), None),
DefaultValue::StaticExpression(expr) => (expr.into(), None),
Expand Down Expand Up @@ -708,7 +708,7 @@ fn split_type_groups() -> impl FnMut(char) -> bool {
}
}

#[derive(Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq)]
enum DefaultVariant {
NotDefined,
Numeric,
Expand Down

0 comments on commit a08f7ac

Please sign in to comment.