Snap for 13905597 from 05256d3244de6a4e7e35593d896eafd094e65b8a to 25Q4-release

Change-Id: Ib11feafbfaf76b67b3e9df1806141c062b3ca0fc
diff --git a/dumpsys_to_lsusb/src/main.rs b/dumpsys_to_lsusb/src/main.rs
index da56137..0cb9785 100644
--- a/dumpsys_to_lsusb/src/main.rs
+++ b/dumpsys_to_lsusb/src/main.rs
@@ -189,7 +189,7 @@
 fn read_sysfs_info(device_sysfs_path: &Path, file_name: &str) -> Result<String> {
     let file_path = device_sysfs_path.join(file_name);
     let sysfs_contents = fs::read_to_string(&file_path)
-        .with_context(|| format!("Failed to read sysfs file: {:?}", file_path))?;
+        .with_context(|| format!("Failed to read sysfs file: {file_path:?}"))?;
     Ok(sysfs_contents.trim().to_string())
 }
 
@@ -348,7 +348,7 @@
                         ),
                         PrintableStructField::new(
                             "type",
-                            endpoint_type.map(|e| format!("{:?}", e)),
+                            endpoint_type.map(|e| format!("{e:?}")),
                             print_aligned_string_output,
                         ),
                         PrintableStructField::new(
@@ -358,7 +358,7 @@
                         ),
                         PrintableStructField::new(
                             "direction",
-                            endpoint_direction.map(|e| format!("{:?}", e)),
+                            endpoint_direction.map(|e| format!("{e:?}")),
                             print_aligned_string_output,
                         ),
                         PrintableStructField::new(
@@ -415,7 +415,7 @@
             self.driver.clone().unwrap_or_default(),
             self.speed.unwrap_or_default()
         ));
-        write!(f, "{}", output)
+        write!(f, "{output}")
     }
 }
 
@@ -514,7 +514,7 @@
     for component in path_components {
         match component {
             UsbPathComponent::Bus(bus_num) => {
-                let bus_key = format!("Bus {:03}", bus_num); // current key
+                let bus_key = format!("Bus {bus_num:03}"); // current key
                 let next_node = hierarchy_ptr
                     .entry(bus_key)
                     .or_insert_with(|| HierarchyNode::Branch(HashMap::new()));
@@ -526,7 +526,7 @@
                 }
             }
             UsbPathComponent::Port(port_num) => {
-                let port_key = format!("Port {:03}", port_num);
+                let port_key = format!("Port {port_num:03}");
                 let next_node = hierarchy_ptr
                     .entry(port_key)
                     .or_insert_with(|| HierarchyNode::Branch(HashMap::new()));
@@ -567,19 +567,19 @@
                 // check if it is the node just above the leaf
                 if sub_hierarchy.len() == 1 && sub_hierarchy.contains_key(LEAF_KEY) {
                     if let Some(HierarchyNode::Leaf(value)) = sub_hierarchy.get(LEAF_KEY) {
-                        outp_writer.print_str_indent(&format!("{prefix}{}: {}", key, value))?;
+                        outp_writer.print_str_indent(&format!("{prefix}{key}: {value}"))?;
                     } else {
                         bail!("Malformed hierarchy {:?}", hierarchy);
                     }
                 } else {
-                    outp_writer.print_str_indent(&format!("{prefix}{}", key))?;
+                    outp_writer.print_str_indent(&format!("{prefix}{key}"))?;
                     outp_writer.indent += INDENT_STEP_TREE;
                     print_device_hierarchy(sub_hierarchy, outp_writer)?;
                     outp_writer.indent -= INDENT_STEP_TREE;
                 }
             }
             HierarchyNode::Leaf(dev_repr) => {
-                outp_writer.print_str_indent(&format!("{prefix}{}", dev_repr))?;
+                outp_writer.print_str_indent(&format!("{prefix}{dev_repr}"))?;
             }
         }
     }
@@ -595,7 +595,7 @@
     for device in devices {
         let (busnum, devnum) = extract_bus_dev(&device.name.clone().unwrap_or_default());
         let mut device_path: PathBuf = find_sysfs_usb_path(busnum, devnum)?;
-        debug!("{:?}", device_path);
+        debug!("{device_path:?}");
         let device_repr = UsbDeviceReprTree {
             devnum,
             interface: None,
@@ -615,7 +615,7 @@
         };
         add_device_to_hierarchy(&mut device_hierarchy, &device_path, device_repr)?;
     }
-    debug!("Constructed device hierarchy: {:?}", device_hierarchy);
+    debug!("Constructed device hierarchy: {device_hierarchy:?}");
     print_device_hierarchy(&device_hierarchy, outp_writer)?;
     Ok(())
 }
diff --git a/typec_connector_class_helper/src/typec_class_utils.rs b/typec_connector_class_helper/src/typec_class_utils.rs
index 0b80099..7b18276 100644
--- a/typec_connector_class_helper/src/typec_class_utils.rs
+++ b/typec_connector_class_helper/src/typec_class_utils.rs
@@ -99,7 +99,7 @@
     /// Prints a string with indentation.
     pub fn print_str_indent(&mut self, str_to_print: &str) -> Result<()> {
         writeln!(self.buffer, "{:indent$}{str_to_print}", "", indent = self.indent)
-            .with_context(|| format!("{ERR_WRITE_TO_BUFFER} {:?}", str_to_print))?;
+            .with_context(|| format!("{ERR_WRITE_TO_BUFFER} {str_to_print:?}"))?;
         Ok(())
     }
 
@@ -107,7 +107,7 @@
     fn print_file_formatted(&mut self, file_path: &Path) -> Result<()> {
         let file_name = get_path_basename(file_path)?;
         let file_contents = fs::read_to_string(file_path)
-            .with_context(|| format!("{ERR_READ_FILE} {:?}", file_path))?;
+            .with_context(|| format!("{ERR_READ_FILE} {file_path:?}"))?;
         let formatted_contents = file_contents
             .trim_ascii_end()
             .replace("\n", format!("\n{:indent$}", "", indent = self.indent).as_str());
@@ -117,7 +117,7 @@
             "",
             indent = self.indent
         )
-        .with_context(|| format!("{ERR_WRITE_TO_BUFFER} {:?}", formatted_contents))?;
+        .with_context(|| format!("{ERR_WRITE_TO_BUFFER} {formatted_contents:?}"))?;
         Ok(())
     }
 
@@ -144,10 +144,10 @@
     path_filter: fn(&PathBuf) -> bool,
 ) -> Result<Vec<PathBuf>> {
     let mut sorted_paths: Vec<PathBuf> = fs::read_dir(dir_path)
-        .with_context(|| format!("{ERR_READ_DIR} {:?}", dir_path))?
+        .with_context(|| format!("{ERR_READ_DIR} {dir_path:?}"))?
         .filter_map(|entry| {
             entry
-                .inspect_err(|err| warn!("{ERR_DIR_ENTRY_ACCESS} {:?}: {err}", dir_path))
+                .inspect_err(|err| warn!("{ERR_DIR_ENTRY_ACCESS} {dir_path:?}: {err}"))
                 .map(|entry| entry.path())
                 .ok()
         })
@@ -161,9 +161,9 @@
 fn get_path_basename(path: &Path) -> Result<&str> {
     let basename = path
         .file_name()
-        .with_context(|| format!("{ERR_FILE_NAME_FROM_PATH} {:?}", path))?
+        .with_context(|| format!("{ERR_FILE_NAME_FROM_PATH} {path:?}"))?
         .to_str()
-        .with_context(|| format!("{ERR_FILE_NAME_UTF_INVALID} {:?}", path))?;
+        .with_context(|| format!("{ERR_FILE_NAME_UTF_INVALID} {path:?}"))?;
     Ok(basename)
 }
 
@@ -291,7 +291,7 @@
     let id_header_vdo = match read_vdo(&id_header_vdo_path) {
         Ok(vdo) => vdo,
         Err(err) => {
-            warn!("{:#}", err);
+            warn!("{err:#}");
             return ProductType::Other;
         }
     };
@@ -376,11 +376,11 @@
 /// Reads a file containing a 32 bit VDO value and loads it into a u32.
 pub fn read_vdo(vdo_path: &Path) -> Result<u32> {
     let vdo_str =
-        fs::read_to_string(vdo_path).with_context(|| format!("{ERR_READ_FILE} {:?}", vdo_path))?;
+        fs::read_to_string(vdo_path).with_context(|| format!("{ERR_READ_FILE} {vdo_path:?}"))?;
     let vdo_str = vdo_str.trim_ascii();
     let vdo: u32 =
         u32::from_str_radix(vdo_str.trim_start_matches("0x"), 16).with_context(|| {
-            format!("Cannot convert string read from path: {:?} to u32: {vdo_str}", vdo_path)
+            format!("Cannot convert string read from path: {vdo_path:?} to u32: {vdo_str}")
         })?;
     Ok(vdo)
 }
@@ -388,7 +388,7 @@
 /// Prints the immediate files in an alternate mode directory, then prints the files in each mode subdirectory.
 pub fn print_alt_mode<W: Write>(alt_mode_dir_path: &Path, out_writer: &mut OutputWriter<W>) {
     if !(alt_mode_dir_path.is_dir() | alt_mode_dir_path.is_symlink()) {
-        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {:?}", alt_mode_dir_path);
+        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {alt_mode_dir_path:?}");
         return;
     }
 
@@ -426,7 +426,7 @@
 /// print_pdo_capabilities to print more detailed PDO information.
 pub fn print_pdos<W: Write>(pdo_dir_path: &Path, out_writer: &mut OutputWriter<W>) {
     if !(pdo_dir_path.is_dir() | pdo_dir_path.is_symlink()) {
-        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {:?}", pdo_dir_path);
+        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {pdo_dir_path:?}");
         return;
     }
 
@@ -476,7 +476,7 @@
 pub fn get_cable_product_type(dir: &Path) -> ProductType {
     let id_header = match read_vdo(&dir.join("identity").join("id_header")) {
         Err(err) => {
-            warn!("get cable type failed to read vdo: {:#}", err);
+            warn!("get cable type failed to read vdo: {err:#}");
             return ProductType::Other;
         }
         Ok(id_header) => id_header,
@@ -518,7 +518,7 @@
 pub fn print_cable_identity<W: Write>(cable: &Path, out_writer: &mut OutputWriter<W>) {
     let mut identity = cable.join("identity");
     if !(identity.is_dir() | identity.is_symlink()) {
-        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {:?}", identity);
+        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {identity:?}");
         return;
     }
 
@@ -559,7 +559,7 @@
 /// * `out_writer` - A mutable reference to an OutputWriter for writing the output.
 pub fn print_plug_info<W: Write>(plug: &Path, out_writer: &mut OutputWriter<W>) {
     if !(plug.is_dir() | plug.is_symlink()) {
-        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {:?}", plug);
+        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {plug:?}");
         return;
     }
 
@@ -632,7 +632,7 @@
 pub fn print_usb_device<W: Write>(usb_port: &Path, out_writer: &mut OutputWriter<W>) {
     let usb_device_dir = usb_port.join("device");
     if !(usb_device_dir.is_dir() | usb_device_dir.is_symlink()) {
-        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {:?}", usb_device_dir);
+        warn!("{ERR_PATH_NOT_DIR_OR_SYMLINK}: {usb_device_dir:?}");
         return;
     }
 
@@ -692,7 +692,7 @@
     for path in get_sorted_paths_from_dir(dir_path, |path| path.is_dir() | path.is_symlink())? {
         // Assumption: all the symlinks created by the Type-C connector class point to directories.
         get_path_basename(&path)
-            .inspect_err(|err| warn!("{:#}", err))
+            .inspect_err(|err| warn!("{err:#}"))
             .is_ok_and(|file_name| re.is_match(file_name))
             .then(|| func(&path, out_writer));
     }
diff --git a/typec_connector_class_helper/src/usb_pd_utils.rs b/typec_connector_class_helper/src/usb_pd_utils.rs
index 04525cc..fa0c38a 100644
--- a/typec_connector_class_helper/src/usb_pd_utils.rs
+++ b/typec_connector_class_helper/src/usb_pd_utils.rs
@@ -32,7 +32,7 @@
     /// Returns the "description: field_value" string for a VDO field.
     pub fn decode_vdo(&self, vdo: u32) -> String {
         let field_val: u32 = (vdo & self.mask) >> self.index;
-        [self.description, &format!(": 0x{:x}", field_val)].concat()
+        [self.description, &format!(": 0x{field_val:x}")].concat()
     }
 }