mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11: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 {
|
||||
None => Expression::StringLiteral("{}".into()),
|
||||
Some(string) => {
|
||||
let mut v = Vec::new();
|
||||
v.push(Expression::StoreLocalVariable {
|
||||
name: local_object,
|
||||
value: Box::new(expr),
|
||||
});
|
||||
v.push(Expression::BinaryExpression {
|
||||
Some(string) => Expression::CodeBlock(vec![
|
||||
Expression::StoreLocalVariable { name: local_object, value: Box::new(expr) },
|
||||
Expression::BinaryExpression {
|
||||
lhs: Box::new(string),
|
||||
op: '+',
|
||||
rhs: Box::new(Expression::StringLiteral(" }".into())),
|
||||
});
|
||||
Expression::CodeBlock(v)
|
||||
}
|
||||
},
|
||||
]),
|
||||
}
|
||||
}
|
||||
Type::Enumeration(enu) => {
|
||||
let local_object = "debug_enum";
|
||||
let mut v = Vec::new();
|
||||
v.push(Expression::StoreLocalVariable {
|
||||
let mut v = vec![Expression::StoreLocalVariable {
|
||||
name: local_object.into(),
|
||||
value: Box::new(expr),
|
||||
});
|
||||
}];
|
||||
let mut cond = Expression::StringLiteral(format!("Error: invalid value for {}", ty));
|
||||
for (idx, val) in enu.values.iter().enumerate() {
|
||||
cond = Expression::Condition {
|
||||
|
|
|
@ -1091,9 +1091,8 @@ fn generate_component(
|
|||
));
|
||||
|
||||
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() {
|
||||
destructor.push("if (!parent) return;".to_owned())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue