rust: Run rustfmt with some experimental options

+ Sort and group the imports
+ Normalize and format comments (100 characters width)

Command used:

$ cargo +nightly fmt --

Acked-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <marc@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2026-05-11 14:43:53 +02:00
committed by Jan Höppner
parent 3d5f75d6c3
commit f8fb9ce32a
120 changed files with 825 additions and 900 deletions
+6 -5
View File
@@ -5,13 +5,14 @@
//! AP support functions for pvapconfig
//
use crate::helper::*;
use pv_core::ap::*;
use pv_core::misc::read_file_string;
use std::path::Path;
use std::slice::Iter;
use std::thread;
use std::time;
use std::{thread, time};
use pv_core::ap::*;
use pv_core::misc::read_file_string;
use crate::helper::*;
const RE_CARD_DIR: &str = r"^card([[:xdigit:]]{2})$";
+6 -5
View File
@@ -5,13 +5,14 @@
//! Functions around handling the pvapconfig configuration file
//
use std::fs::File;
use std::slice::Iter;
use openssl::sha::sha256;
use pv_core::misc::encode_hex;
use regex::Regex;
use serde::{Deserialize, Serialize};
use serde_yaml::{self};
use std::fs::File;
use std::slice::Iter;
pub const STR_MODE_EP11: &str = "ep11";
pub const STR_MODE_ACCEL: &str = "accel";
@@ -209,10 +210,10 @@ impl ApConfigList {
#[cfg(test)]
mod tests {
use super::*;
use std::env;
use std::fs;
use std::io::Write;
use std::{env, fs};
use super::*;
const GOOD_CONFIGS: [&str; 8] = [
"# good test 1
+4 -2
View File
@@ -5,13 +5,14 @@
//! Collection of helper functions for pvapconfig
//
use regex::Regex;
use std::error::Error;
use std::fs;
use std::fs::OpenOptions;
use std::io::Write;
use std::path::PathBuf;
use regex::Regex;
pub const PATH_PVAPCONFIG_LOCK: &str = "/run/lock/pvapconfig.lock";
/// For a given (sysfs) directory construct a list of all subdirs
@@ -129,9 +130,10 @@ impl Drop for LockFile {
#[cfg(test)]
mod tests {
use super::*;
use utils::TemporaryDirectory;
use super::*;
// Only very simple tests
#[test]
+5 -2
View File
@@ -12,6 +12,8 @@ mod config;
mod helper;
mod uv;
use std::process::ExitCode;
use ap::ApqnList;
use cli::ARGS;
use config::{ApConfigEntry, ApConfigList};
@@ -19,7 +21,6 @@ use helper::{LockFile, PATH_PVAPCONFIG_LOCK};
use pv_core::ap::{self as pvap, Apqn};
use pv_core::misc::encode_hex;
use pv_core::uv::{ListableSecretType, SecretList};
use std::process::ExitCode;
use utils::print_version;
/// Simple macro for
@@ -456,8 +457,10 @@ fn config_and_apqn_match(apc: &ApConfigEntry, apqn: &Apqn) -> bool {
#[cfg(test)]
mod tests {
use pv_core::misc::decode_hex;
use pv_core::uv::SecretEntry;
use super::*;
use pv_core::{misc::decode_hex, uv::SecretEntry};
// This is more or less only a test for the do_ap_config() function
// However, this is THE main functionality of the whole application.