Skip to content

Commit 55dde8f

Browse files
dfaure-kdabogoffart
authored andcommitted
compiler: some clippy fixes
1 parent 36b305a commit 55dde8f

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

internal/compiler/llr/lower_expression.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ fn grid_layout_cell_constraints(
972972

973973
if repeater_count == 0 {
974974
let cells = llr_Expression::Array {
975-
element_ty: element_ty.into(),
975+
element_ty: element_ty,
976976
values: layout
977977
.elems
978978
.iter()
@@ -1027,7 +1027,7 @@ fn grid_layout_input_data(
10271027
) -> GridLayoutInputDataResult {
10281028
let propref = |named_ref: &RowColExpr| match named_ref {
10291029
RowColExpr::Literal(n) => llr_Expression::NumberLiteral((*n).into()),
1030-
RowColExpr::Named(nr) => llr_Expression::PropertyReference(ctx.map_property_reference(&nr)),
1030+
RowColExpr::Named(nr) => llr_Expression::PropertyReference(ctx.map_property_reference(nr)),
10311031
RowColExpr::Auto => llr_Expression::NumberLiteral(i_slint_common::ROW_COL_AUTO as _),
10321032
};
10331033
let input_data_for_cell = |elem: &crate::layout::GridLayoutElement,

internal/compiler/object_tree.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,7 @@ impl Component {
551551

552552
/// This is an interface introduced with the "interface" keyword
553553
pub fn is_interface(&self) -> bool {
554-
match &self.root_element.borrow().base_type {
555-
ElementType::Interface => true,
556-
_ => false,
557-
}
554+
matches!(&self.root_element.borrow().base_type, ElementType::Interface)
558555
}
559556

560557
/// Returns the names of aliases to global singletons, exactly as
@@ -1087,11 +1084,11 @@ fn expected_relationship_to_parent(node: &syntax_nodes::Element) -> Option<Paren
10871084
let implements_inherits_identifier =
10881085
parent.children_with_tokens().filter(|n| n.kind() == SyntaxKind::Identifier).nth(1)?;
10891086
let token = implements_inherits_identifier.as_token()?;
1090-
return match token.text() {
1087+
match token.text() {
10911088
"inherits" => Some(ParentRelationship::Inherits),
10921089
"implements" => Some(ParentRelationship::Implements),
10931090
_ => None,
1094-
};
1091+
}
10951092
}
10961093

10971094
impl Element {
@@ -1129,7 +1126,7 @@ impl Element {
11291126
(Ok(ElementType::Component(c)), Some(ParentRelationship::Implements)) => {
11301127
if !diag.enable_experimental {
11311128
diag.push_error(
1132-
format!("'implements' is an experimental feature"),
1129+
"'implements' is an experimental feature".into(),
11331130
&base_node,
11341131
);
11351132
ElementType::Error
@@ -1149,7 +1146,7 @@ impl Element {
11491146
(Ok(ElementType::Builtin(_bt)), Some(ParentRelationship::Implements)) => {
11501147
if !diag.enable_experimental {
11511148
diag.push_error(
1152-
format!("'implements' is an experimental feature"),
1149+
"'implements' is an experimental feature".into(),
11531150
&base_node,
11541151
);
11551152
} else {

internal/compiler/parser/document.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ pub fn parse_component(p: &mut impl Parser) -> bool {
141141
}
142142
if is_global {
143143
if p.peek().kind() == SyntaxKind::ColonEqual {
144-
p.warning(format!("':=' to declare a global is deprecated. Remove the ':='"));
144+
p.warning("':=' to declare a global is deprecated. Remove the ':='");
145145
p.consume();
146146
}
147147
} else if is_interface {
148148
if p.peek().kind() == SyntaxKind::ColonEqual {
149-
p.error(format!("':=' to declare an interface is not supported. Remove the ':='"));
149+
p.error("':=' to declare an interface is not supported. Remove the ':='");
150150
p.consume();
151151
}
152152
} else if !is_new_component {

0 commit comments

Comments
 (0)