Skip to content

Commit 2585cb9

Browse files
authored
Merge branch 'main' into use-msrustup
2 parents 6a63e46 + 4f0e7fd commit 2585cb9

File tree

11 files changed

+24
-26
lines changed

11 files changed

+24
-26
lines changed

dsc/src/resource_command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub fn schema(dsc: &DscManager, resource_type: &str, format: Option<&OutputForma
199199
error!("Error: {err}");
200200
exit(EXIT_JSON_ERROR);
201201
}
202-
};
202+
}
203203
write_object(&json, format, false);
204204
}
205205
Err(err) => {

dsc/src/subcommand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ pub fn config(subcommand: &ConfigSubCommand, parameters: &Option<String>, mounte
316316
if *what_if {
317317
configurator.context.execution_type = ExecutionKind::WhatIf;
318318
}
319-
};
319+
}
320320

321321
let parameters: Option<serde_json::Value> = match if new_parameters.is_some() {
322322
&new_parameters
@@ -407,7 +407,7 @@ pub fn config(subcommand: &ConfigSubCommand, parameters: &Option<String>, mounte
407407
error!("{err}");
408408
result.valid = false;
409409
}
410-
};
410+
}
411411
}
412412

413413
let Ok(json) = serde_json::to_string(&result) else {

dsc/src/tablewriter.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
14
use crossterm::terminal::size;
25

36
pub struct Table {
@@ -45,6 +48,7 @@ impl Table {
4548
}
4649

4750
/// Print the table to the console.
51+
#[allow(clippy::format_push_string)]
4852
pub fn print(&self) {
4953
let (width, _) = size().unwrap_or((80, 25));
5054
// make header bright green

dsc/src/util.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,11 @@ pub fn enable_tracing(trace_level_arg: Option<&TraceLevel>, trace_format_arg: Op
330330
if !policy_is_used {
331331
if let Some(v) = trace_level_arg {
332332
tracing_setting.level = v.clone();
333-
};
333+
}
334334
if let Some(v) = trace_format_arg {
335335
tracing_setting.format = v.clone();
336-
};
337-
};
336+
}
337+
}
338338

339339
// convert to 'tracing' crate type
340340
let tracing_level = match tracing_setting.level {
@@ -421,7 +421,7 @@ pub fn validate_json(source: &str, schema: &Value, json: &Value) -> Result<(), D
421421

422422
if let Err(err) = compiled_schema.validate(json) {
423423
return Err(DscError::Validation(format!("{}: '{source}' {err}", t!("util.validationFailed"))));
424-
};
424+
}
425425

426426
Ok(())
427427
}

dsc_lib/src/configure/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ fn escape_property_values(properties: &Map<String, Value>) -> Result<Option<Map<
8888
Value::Object(object) => {
8989
let value = escape_property_values(&object.clone())?;
9090
result.insert(name.clone(), serde_json::to_value(value)?);
91-
continue;
9291
},
9392
Value::Array(array) => {
9493
let mut result_array: Vec<Value> = Vec::new();
@@ -97,7 +96,6 @@ fn escape_property_values(properties: &Map<String, Value>) -> Result<Option<Map<
9796
Value::Object(object) => {
9897
let value = escape_property_values(&object.clone())?;
9998
result_array.push(serde_json::to_value(value)?);
100-
continue;
10199
},
102100
Value::Array(_) => {
103101
return Err(DscError::Parser(t!("configure.mod.nestedArraysNotSupported").to_string()));
@@ -779,7 +777,6 @@ impl Configurator {
779777
Value::Object(object) => {
780778
let value = self.invoke_property_expressions(Some(object))?;
781779
result.insert(name.clone(), serde_json::to_value(value)?);
782-
continue;
783780
},
784781
Value::Array(array) => {
785782
let mut result_array: Vec<Value> = Vec::new();
@@ -788,7 +785,6 @@ impl Configurator {
788785
Value::Object(object) => {
789786
let value = self.invoke_property_expressions(Some(object))?;
790787
result_array.push(serde_json::to_value(value)?);
791-
continue;
792788
},
793789
Value::Array(_) => {
794790
return Err(DscError::Parser(t!("configure.mod.nestedArraysNotSupported").to_string()));
@@ -821,7 +817,7 @@ impl Configurator {
821817
result.insert(name.clone(), Value::String(string_result.to_string()));
822818
} else {
823819
result.insert(name.clone(), statement_result);
824-
};
820+
}
825821
},
826822
_ => {
827823
result.insert(name.clone(), value.clone());

dsc_lib/src/discovery/command_discovery.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl CommandDiscovery {
152152
}
153153
}
154154
}
155-
};
155+
}
156156

157157
if let Ok(final_resource_path) = env::join_paths(paths.clone()) {
158158
debug!("{}", t!("discovery.commandDiscovery.usingResourcePath", path = final_resource_path.to_string_lossy()));
@@ -334,9 +334,8 @@ impl ResourceDiscovery for CommandDiscovery {
334334
},
335335
Result::Err(err) => {
336336
warn!("Failed to parse resource: {line} -> {err}");
337-
continue;
338337
}
339-
};
338+
}
340339
}
341340

342341
adapter_progress.write_increment(1);
@@ -625,11 +624,11 @@ fn add_resources_to_lookup_table(adapted_resources: &BTreeMap<String, Vec<DscRes
625624
let oldvalue = lookup_table.insert(resource_name.to_string().to_lowercase(), new_value.clone());
626625
if !lookup_table_changed && (oldvalue.is_none() || oldvalue.is_some_and(|val| val != new_value)) {
627626
lookup_table_changed = true;
628-
};
627+
}
629628
} else {
630629
info!("Resource '{resource_name}' in 'adapted_resources' is missing 'require_adapter' field.");
631630
}
632-
};
631+
}
633632

634633
if lookup_table_changed {
635634
save_adapted_resources_lookup_table(&lookup_table);

dsc_lib/src/dscresources/command_resource.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,8 @@ fn json_to_hashmap(json: &str) -> Result<HashMap<String, String>, DscError> {
814814
map.insert(key, array.join(","));
815815
},
816816
Value::Null => {
817-
continue;
818-
}
817+
// ignore null values
818+
},
819819
Value::Object(_) => {
820820
return Err(DscError::Operation(t!("dscresources.commandResource.invalidKey", key = key).to_string()));
821821
},
@@ -884,13 +884,13 @@ pub fn log_stderr_line<'a>(process_id: &u32, trace_line: &'a str) -> &'a str
884884
// the line is a valid json, but not one of standard trace lines - return it as filtered stderr_line
885885
trace!("PID {process_id}: {trace_line}");
886886
return trace_line;
887-
};
887+
}
888888
} else {
889889
// the line is not a valid json - return it as filtered stderr_line
890890
trace!("PID {process_id}: {}", trace_line);
891891
return trace_line;
892892
}
893-
};
893+
}
894894

895895
""
896896
}

dsc_lib/src/schemas/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub(crate) fn get_recognized_schema_uri(
219219
///
220220
/// Parameters:
221221
///
222-
///- `schema_file_base_name` - specify the base name for the schema file, like `document` for
222+
/// - `schema_file_base_name` - specify the base name for the schema file, like `document` for
223223
/// the configuration document schema or `manifest` for the resource manifest schema.
224224
/// - `schema_folder_path` - specify the folder path for the schema file relative to the version
225225
/// folder, like `config` for the configuration document schema or `resource` for the resource
@@ -300,7 +300,7 @@ pub(crate) fn get_recognized_uris_subschema(
300300
///
301301
/// Parameters:
302302
///
303-
///- `schema_file_base_name` - specify the base name for the schema file, like `document` for
303+
/// - `schema_file_base_name` - specify the base name for the schema file, like `document` for
304304
/// the configuration document schema or `manifest` for the resource manifest schema.
305305
/// - `schema_folder_path` - specify the folder path for the schema file relative to the version
306306
/// folder, like `config` for the configuration document schema or `resource` for the resource

dsc_lib/src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub fn get_exe_path() -> Result<PathBuf, DscError> {
152152
if let Ok(exe) = env::current_exe() {
153153
if let Ok(target_path) = fs::read_link(exe.clone()) {
154154
return Ok(target_path);
155-
};
155+
}
156156

157157
return Ok(exe);
158158
}

registry/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ fn check_debug() {
163163
}
164164
} else {
165165
eprintln!("{}", t!("main.debugEventUnexpectedError", e = event : {:?}));
166-
continue;
167166
}
168167
}
169168
}

registry/src/registry_helper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl RegistryHelper {
175175

176176
if let Some(reg_key) = reg_key {
177177
reg_key.set_value(&value_name, &data)?;
178-
};
178+
}
179179
}
180180

181181
if self.what_if {

0 commit comments

Comments
 (0)