diff --git a/northstar-runtime/src/common/version.rs b/northstar-runtime/src/common/version.rs index b7c1ac5eb..ca9f01c84 100644 --- a/northstar-runtime/src/common/version.rs +++ b/northstar-runtime/src/common/version.rs @@ -1,5 +1,9 @@ use serde::{Deserialize, Serialize}; -use std::{cmp::Ordering, fmt, str::FromStr}; +use std::{ + cmp::Ordering, + fmt::{self, Display}, + str::FromStr, +}; use thiserror::Error; /// Parsing error @@ -164,9 +168,9 @@ impl FromStr for VersionReq { } } -impl ToString for VersionReq { - fn to_string(&self) -> String { - self.inner.to_string() +impl Display for VersionReq { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.inner) } } diff --git a/northstar-runtime/src/npk/manifest/mod.rs b/northstar-runtime/src/npk/manifest/mod.rs index 7dc9f30e5..93effb736 100644 --- a/northstar-runtime/src/npk/manifest/mod.rs +++ b/northstar-runtime/src/npk/manifest/mod.rs @@ -198,16 +198,6 @@ impl FromStr for Manifest { } } -impl ToString for Manifest { - #[allow(clippy::unwrap_used)] - fn to_string(&self) -> String { - // A `Manifest` is convertible to `String` as long as its implementation of `Serialize` does - // not return an error. This should never happen for the types that we use in `Manifest` so - // we can safely use .unwrap() here. - serde_yaml::to_string(self).expect("failed to serialize manifest") - } -} - /// Validate manifest. fn validate(manifest: &Manifest) -> Result<(), ValidationError> { // Most optionals in the manifest are not valid for a resource container diff --git a/northstar-runtime/src/npk/npk.rs b/northstar-runtime/src/npk/npk.rs index 8e12cd886..477c9caab 100644 --- a/northstar-runtime/src/npk/npk.rs +++ b/northstar-runtime/src/npk/npk.rs @@ -499,7 +499,8 @@ impl<'a> NpkBuilder<'a> { zip.set_comment(meta_str); // Add manifest. - let manifest_str = manifest.to_string(); + let manifest_str = + serde_yaml::to_string(manifest).context("failed to serialize manifest")?; zip.start_file(MANIFEST_NAME, options) .context("failed to write manifest to NPK")?; zip.write_all(manifest_str.as_bytes()) diff --git a/northstar-runtime/src/runtime/ipc/raw_fd_ext.rs b/northstar-runtime/src/runtime/ipc/raw_fd_ext.rs index e3b5ab2e4..a30a345ea 100644 --- a/northstar-runtime/src/runtime/ipc/raw_fd_ext.rs +++ b/northstar-runtime/src/runtime/ipc/raw_fd_ext.rs @@ -3,6 +3,7 @@ use std::{io, io::Result, os::unix::prelude::AsRawFd}; pub trait RawFdExt: AsRawFd { /// Returns true of self is set to non-blocking. + #[allow(unused)] fn is_nonblocking(&self) -> Result; /// Set non-blocking mode. diff --git a/northstar-runtime/src/runtime/mod.rs b/northstar-runtime/src/runtime/mod.rs index a67847b50..e16bda410 100644 --- a/northstar-runtime/src/runtime/mod.rs +++ b/northstar-runtime/src/runtime/mod.rs @@ -1,6 +1,7 @@ mod cgroups; mod console; mod debug; +#[allow(unused)] mod devicemapper; mod env; mod error;