Skip to content

Commit 606e94a

Browse files
committed
fix clippy
1 parent a277252 commit 606e94a

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

dsc_lib/src/dscresources/dscresource.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl DscResource {
187187
after_state: after_state.clone(),
188188
changed_properties: if diff.is_empty() { None } else { Some(diff) },
189189
});
190-
return Ok(set_result);
190+
Ok(set_result)
191191
}
192192

193193
fn invoke_test_with_adapter(&self, adapter: &str, resource_name: &str, expected: &str) -> Result<TestResult, DscError> {
@@ -221,7 +221,7 @@ impl DscResource {
221221
in_desired_state: resource_result.in_desired_state,
222222
diff_properties,
223223
});
224-
return Ok(test_result);
224+
Ok(test_result)
225225
}
226226

227227
fn invoke_delete_with_adapter(&self, adapter: &str, resource_name: &str, filter: &str) -> Result<(), DscError> {
@@ -236,7 +236,7 @@ impl DscResource {
236236
}
237237

238238
configurator.invoke_set(false)?;
239-
return Ok(());
239+
Ok(())
240240
}
241241

242242
fn invoke_export_with_adapter(&self, adapter: &str, input: &str) -> Result<ExportResult, DscError> {
@@ -266,7 +266,7 @@ impl DscResource {
266266
export_result.actual_state.push(serde_json::to_value(result.clone())?);
267267
}
268268
}
269-
return Ok(export_result);
269+
Ok(export_result)
270270
}
271271

272272
fn get_adapter_resource(configurator: &mut Configurator, adapter: &str) -> Result<DscResource, DscError> {
@@ -620,6 +620,19 @@ pub fn redact(value: &Value) -> Value {
620620
///
621621
/// # Errors
622622
/// * `DscError` - The adapter manifest is not found or invalid
623+
/// Retrieve the kind of adapter
624+
///
625+
/// # Arguments
626+
///
627+
/// * `adapter` - The adapter resource
628+
///
629+
/// # Returns
630+
///
631+
/// The input kind of the adapter
632+
///
633+
/// # Errors
634+
///
635+
/// * `DscError` - The adapter does not have a manifest or the manifest is invalid
623636
pub fn get_adapter_input_kind(adapter: &DscResource) -> Result<AdapterInputKind, DscError> {
624637
if let Some(manifest) = &adapter.manifest {
625638
if let Ok(manifest) = serde_json::from_value::<ResourceManifest>(manifest.clone()) {

tools/dsctest/src/adapter.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ pub struct DscResource {
4949
}
5050

5151
pub fn adapt(resource_type: &str, input: &str, operation: &AdapterOperation) -> Result<String, String> {
52+
<<<<<<< HEAD
5253
match operation {
54+
||||||| parent of c22f78ea (fix clippy)
55+
pub fn adapt(resource_type: &str, input: &str, operation: AdapterOperation) -> Result<String, String> {
56+
match operation {
57+
=======
58+
match *operation {
59+
>>>>>>> c22f78ea (fix clippy)
5360
AdapterOperation::List => {
5461
let resource_one = DscResource {
5562
type_name: "Adapted/One".to_string(),
@@ -93,7 +100,7 @@ pub fn adapt(resource_type: &str, input: &str, operation: &AdapterOperation) ->
93100
};
94101
Ok(serde_json::to_string(&adapted_two).unwrap())
95102
},
96-
_ => Err(format!("Unknown resource type: {}", resource_type)),
103+
_ => Err(format!("Unknown resource type: {resource_type}")),
97104
}
98105
},
99106
AdapterOperation::Set | AdapterOperation::Test => {
@@ -139,7 +146,7 @@ pub fn adapt(resource_type: &str, input: &str, operation: &AdapterOperation) ->
139146
println!("{}", serde_json::to_string(&adapted_two).unwrap());
140147
std::process::exit(0);
141148
},
142-
_ => Err(format!("Unknown resource type: {}", resource_type)),
149+
_ => Err(format!("Unknown resource type: {resource_type}")),
143150
}
144151
},
145152
AdapterOperation::Validate => {

0 commit comments

Comments
 (0)