mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Janitor: calls to push
immediately after creation
This is clippy::vec_init_then_push.
This commit is contained in:
parent
5e2e8dac40
commit
ca53abdbc7
2 changed files with 8 additions and 15 deletions
|
@ -258,28 +258,22 @@ fn to_debug_string(
|
||||||
}
|
}
|
||||||
match string {
|
match string {
|
||||||
None => Expression::StringLiteral("{}".into()),
|
None => Expression::StringLiteral("{}".into()),
|
||||||
Some(string) => {
|
Some(string) => Expression::CodeBlock(vec![
|
||||||
let mut v = Vec::new();
|
Expression::StoreLocalVariable { name: local_object, value: Box::new(expr) },
|
||||||
v.push(Expression::StoreLocalVariable {
|
Expression::BinaryExpression {
|
||||||
name: local_object,
|
|
||||||
value: Box::new(expr),
|
|
||||||
});
|
|
||||||
v.push(Expression::BinaryExpression {
|
|
||||||
lhs: Box::new(string),
|
lhs: Box::new(string),
|
||||||
op: '+',
|
op: '+',
|
||||||
rhs: Box::new(Expression::StringLiteral(" }".into())),
|
rhs: Box::new(Expression::StringLiteral(" }".into())),
|
||||||
});
|
},
|
||||||
Expression::CodeBlock(v)
|
]),
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Type::Enumeration(enu) => {
|
Type::Enumeration(enu) => {
|
||||||
let local_object = "debug_enum";
|
let local_object = "debug_enum";
|
||||||
let mut v = Vec::new();
|
let mut v = vec![Expression::StoreLocalVariable {
|
||||||
v.push(Expression::StoreLocalVariable {
|
|
||||||
name: local_object.into(),
|
name: local_object.into(),
|
||||||
value: Box::new(expr),
|
value: Box::new(expr),
|
||||||
});
|
}];
|
||||||
let mut cond = Expression::StringLiteral(format!("Error: invalid value for {}", ty));
|
let mut cond = Expression::StringLiteral(format!("Error: invalid value for {}", ty));
|
||||||
for (idx, val) in enu.values.iter().enumerate() {
|
for (idx, val) in enu.values.iter().enumerate() {
|
||||||
cond = Expression::Condition {
|
cond = Expression::Condition {
|
||||||
|
|
|
@ -1091,9 +1091,8 @@ fn generate_component(
|
||||||
));
|
));
|
||||||
|
|
||||||
if !component.is_global() {
|
if !component.is_global() {
|
||||||
let mut destructor = Vec::new();
|
let mut destructor = vec!["[[maybe_unused]] auto self = this;".to_owned()];
|
||||||
|
|
||||||
destructor.push("[[maybe_unused]] auto self = this;".to_owned());
|
|
||||||
if component.parent_element.upgrade().is_some() {
|
if component.parent_element.upgrade().is_some() {
|
||||||
destructor.push("if (!parent) return;".to_owned())
|
destructor.push("if (!parent) return;".to_owned())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue