Skip to content

Commit daccab1

Browse files
committed
fix clippy
1 parent d2920bc commit daccab1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dsc_lib/src/configure/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -898,14 +898,13 @@ impl Configurator {
898898
return Err(DscError::Validation(t!("configure.mod.copyBatchSizeNotSupported").to_string()));
899899
}
900900
self.context.process_mode = ProcessMode::Copy;
901-
self.context.copy_current_loop_name = copy.name.clone();
901+
self.context.copy_current_loop_name.clone_from(&copy.name);
902902
let mut copy_resources = Vec::<Resource>::new();
903903
for i in 0..copy.count {
904904
self.context.copy.insert(copy.name.clone(), i);
905905
let mut new_resource = resource.clone();
906-
let new_name = match self.statement_parser.parse_and_execute(&resource.name, &self.context)? {
907-
Value::String(s) => s,
908-
_ => return Err(DscError::Parser(t!("configure.mod.copyNameResultNotString", name = &copy.name).to_string())),
906+
let Value::String(new_name) = self.statement_parser.parse_and_execute(&resource.name, &self.context)? else {
907+
return Err(DscError::Parser(t!("configure.mod.copyNameResultNotString", name = &copy.name).to_string()))
909908
};
910909
new_resource.name = new_name.to_string();
911910
new_resource.copy = None;

dsc_lib/src/functions/copy_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Function for CopyIndex {
6161
if let Some(loop_name) = args[0].as_str() {
6262
if let Some(index) = context.copy.get(loop_name) {
6363
if let Some(offset) = args[1].as_i64() {
64-
Ok(Value::Number(((*index as i64) + offset).into()))
64+
Ok(Value::Number(((*index) + offset).into()))
6565
} else {
6666
Err(DscError::Parser(t!("functions.invalidArguments").to_string()))
6767
}

0 commit comments

Comments
 (0)