tree-wide: replace serde_json::from_value(a_value.clone())
`&Value` itself implements `Deserializer` and can therefore be passed directly to `T::deserialize` without requiring an intermediate `clone()`. (This also enables optionally borrowing strings if the result has a short enough lifetime) Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
		
				
					committed by
					
						 Thomas Lamprecht
						Thomas Lamprecht
					
				
			
			
				
	
			
			
			
						parent
						
							845baef61b
						
					
				
				
					commit
					38774184a9
				
			| @ -1,6 +1,6 @@ | ||||
| use anyhow::{Error, bail}; | ||||
| use serde::{Deserialize, Serialize}; | ||||
| use serde_json::{Value, to_value}; | ||||
| use ::serde::{Deserialize, Serialize}; | ||||
| use hex::FromHex; | ||||
|  | ||||
| use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission}; | ||||
| @ -539,7 +539,7 @@ pub fn update_interface( | ||||
|     let interface = config.lookup_mut(&iface)?; | ||||
|  | ||||
|     if let Some(interface_type) = param.get("type") { | ||||
|         let interface_type: NetworkInterfaceType = serde_json::from_value(interface_type.clone())?; | ||||
|         let interface_type = NetworkInterfaceType::deserialize(interface_type)?; | ||||
|         if  interface_type != interface.interface_type { | ||||
|             bail!("got unexpected interface type ({:?} != {:?})", interface_type, interface.interface_type); | ||||
|         } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user