Skip to content

Commit

Permalink
Fix cargo clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Gris Ge <fge@redhat.com>
  • Loading branch information
cathay4t committed May 23, 2024
1 parent a907b00 commit e7e3a7d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rust/src/cli/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub(crate) fn sort_netstate(
let mut new_iface = serde_yaml::Mapping::new();
for top_property in &IFACE_TOP_PRIORTIES {
if let Some(v) =
iface.get(&Value::String(top_property.to_string()))
iface.get(Value::String(top_property.to_string()))
{
new_iface.insert(
Value::String(top_property.to_string()),
Expand Down
10 changes: 5 additions & 5 deletions rust/src/lib/ifaces/inter_ifaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ impl Interfaces {
&mut self,
) -> Result<(), NmstateError> {
let mut new_ifaces = Vec::new();
for iface in self.kernel_ifaces.values_mut() {
if let Interface::Unknown(iface) = iface {
for iface in self.kernel_ifaces.values() {
if let Interface::Unknown(iface) = &iface {
log::warn!(
"Setting unknown type interface {} to ethernet",
iface.base.name.as_str()
);
let iface_value = match serde_json::to_value(&iface) {
let iface_value = match serde_json::to_value(iface) {
Ok(mut v) => {
if let Some(v) = v.as_object_mut() {
v.insert(
Expand All @@ -552,8 +552,8 @@ impl Interfaces {
return Err(NmstateError::new(
ErrorKind::Bug,
format!(
"BUG: Failed to convert {iface:?} to serde_json \
value: {e}"
"BUG: Failed to convert {iface:?} to \
serde_json value: {e}"
),
));
}
Expand Down
1 change: 1 addition & 0 deletions rust/src/lib/ifaces/loopback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{BaseInterface, ErrorKind, InterfaceType, NmstateError};
/// * Even not desired, the `127.0.0.1/8` and `::1` are always appended to
/// static IP address list.
/// * Require NetworkManager 1.41+ unless in kernel only mode.
///
/// Example yaml outpuf of `[crate::NetworkState]` with loopback interface:
/// ```yml
/// interfaces:
Expand Down
4 changes: 2 additions & 2 deletions rust/src/lib/query_apply/iface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ impl Interface {
let mut current = current.clone();
self.process_allow_extra_address(&mut current);

let self_value = serde_json::to_value(&self)?;
let current_value = serde_json::to_value(&current)?;
let self_value = serde_json::to_value(self.clone())?;
let current_value = serde_json::to_value(current.clone())?;

if let Some((reference, desire, current)) = get_json_value_difference(
format!("{}.interface", self.name()),
Expand Down

0 comments on commit e7e3a7d

Please sign in to comment.