mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-12-08 22:13:52 +00:00
various: fix clippy warnings
- Adds proper documentation comments with `# Errors` sections for all functions returning `Result` - `cast_precision_loss` on `u64` -> `f64` for disk sizes is acceptable since disk sizes won't exceed f64's precision limit in practice. Thus, we can suppress those. - `cast_sign_loss` and `cast_possible_truncation` on the percentage calculation is safe since percentages are always 0-100. Once again, it's safe to suppress. Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id4dd7ebc9674407d2be4f38ff4de24bc6a6a6964
This commit is contained in:
parent
2ad765ef98
commit
f4f3385ff7
3 changed files with 23 additions and 0 deletions
|
|
@ -21,6 +21,11 @@ pub fn get_system_info(utsname: &UtsName) -> String {
|
|||
result
|
||||
}
|
||||
|
||||
/// Gets the pretty name of the OS from `/etc/os-release`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an error if `/etc/os-release` cannot be read.
|
||||
#[cfg_attr(feature = "hotpath", hotpath::measure)]
|
||||
pub fn get_os_pretty_name() -> Result<String, io::Error> {
|
||||
// We use a stack-allocated buffer here, which seems to perform MUCH better
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue