mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pv_*: Add more deny lints to pv and pv_core
Denies compiling if one of the following lints find something in pv or
pv_core:
missing_docs,
missing_debug_implementations,
trivial_numeric_casts,
unstable_features,
unused_import_braces,
unused_qualifications
Those lint force developers to avoid unnecessary code and providing
debuggability & documentation for each public symbol.
Fix the compile time error introduced with those lints.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright IBM Corp. 2023, 2024
|
||||
#![deny(missing_docs)]
|
||||
#![deny(
|
||||
missing_docs,
|
||||
missing_debug_implementations,
|
||||
trivial_numeric_casts,
|
||||
unstable_features,
|
||||
unused_import_braces,
|
||||
unused_qualifications
|
||||
)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
mod error;
|
||||
mod macros;
|
||||
|
||||
@@ -224,8 +224,8 @@ pub fn read_exact_file<P: AsRef<Path>, const COUNT: usize>(
|
||||
path: P,
|
||||
ctx: &str,
|
||||
) -> Result<[u8; COUNT]> {
|
||||
let mut f = std::fs::File::open(&path).map_err(|e| Error::FileAccess {
|
||||
ty: crate::FileAccessErrorType::Open,
|
||||
let mut f = File::open(&path).map_err(|e| Error::FileAccess {
|
||||
ty: FileAccessErrorType::Open,
|
||||
path: path_to_str!(path).to_string(),
|
||||
source: e,
|
||||
})?;
|
||||
|
||||
@@ -187,6 +187,7 @@ pub enum UvcSuccess {
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub struct UvDevice(File);
|
||||
|
||||
impl UvDevice {
|
||||
|
||||
@@ -10,6 +10,7 @@ use std::io::Read;
|
||||
///
|
||||
/// The List Secrets Ultravisor call is used to list the
|
||||
/// secrets that are in the secret store for the current SE-guest.
|
||||
#[derive(Debug)]
|
||||
pub struct ListCmd(Vec<u8>);
|
||||
impl ListCmd {
|
||||
fn with_size(size: usize) -> Self {
|
||||
@@ -44,6 +45,7 @@ impl UvCmd for ListCmd {
|
||||
///
|
||||
/// The Add Secret Ultravisor-call is used to add a secret
|
||||
/// to the secret store for the current SE-guest.
|
||||
#[derive(Debug)]
|
||||
pub struct AddCmd(Vec<u8>);
|
||||
|
||||
impl AddCmd {
|
||||
@@ -101,6 +103,7 @@ impl UvCmd for AddCmd {
|
||||
/// all changes to the secret store. Upon successful
|
||||
/// completion of a Lock Secret Store Ultravisor-call, any
|
||||
/// request to modify the secret store will fail.
|
||||
#[derive(Debug)]
|
||||
pub struct LockCmd;
|
||||
impl UvCmd for LockCmd {
|
||||
const UV_IOCTL_NR: u8 = ffi::UVIO_IOCTL_LOCK_SECRETS_NR;
|
||||
|
||||
@@ -278,7 +278,7 @@ fn ser_u16<S: Serializer>(v: &U16<BigEndian>, ser: S) -> Result<S::Ok, S::Error>
|
||||
|
||||
/// Secret types that can appear in a [`SecretList`]
|
||||
#[non_exhaustive]
|
||||
#[derive(PartialEq, Eq)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum ListableSecretType {
|
||||
/// Association Secret
|
||||
Association,
|
||||
|
||||
@@ -126,7 +126,7 @@ impl UvCmd for TestCmd {
|
||||
impl UvDevice {
|
||||
///use some random fd for `uvdevice` its OK, as the ioctl is mocked and never touches the passed file
|
||||
fn test_dev() -> Self {
|
||||
UvDevice(unsafe { std::fs::File::from_raw_fd(17) })
|
||||
UvDevice(unsafe { File::from_raw_fd(17) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user