From b4d3b9203a125c27a23a303b6cbedef78f344af6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 25 Mar 2026 17:26:47 +0300 Subject: [PATCH 1/2] microfetch: consume library exports in binary crate Signed-off-by: NotAShelf Change-Id: Id6c10efbb185fc44fcf22e6ab5c94a266a6a6964 --- src/main.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index ebc1e83..351e338 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,18 +1,11 @@ -mod colors; -mod desktop; -mod release; -mod syscall; -mod system; -mod uptime; - use std::io::{self, Cursor, Write}; -pub use microfetch_lib::UtsName; - -use crate::{ - colors::print_dots, +use microfetch_lib::{ + UtsName, + colors::{COLORS, print_dots}, desktop::get_desktop_info, release::{get_os_pretty_name, get_system_info}, + syscall::sys_write, system::{ get_memory_usage, get_root_disk_usage, @@ -64,8 +57,6 @@ struct Fields { fn print_system_info( fields: &Fields, ) -> Result<(), Box> { - use crate::colors::COLORS; - let Fields { user_info, os_name, @@ -102,7 +93,7 @@ fn print_system_info( let len = usize::try_from(cursor.position()).expect("cursor position fits usize"); // Direct syscall to avoid stdout buffering allocation - let written = unsafe { syscall::sys_write(1, buf.as_ptr(), len) }; + let written = unsafe { sys_write(1, buf.as_ptr(), len) }; if written < 0 { return Err(io::Error::last_os_error().into()); } From 928452faba58a261f78e32c5e549dfe5ad8caf16 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 25 Mar 2026 17:40:37 +0300 Subject: [PATCH 2/2] chore: enable explicit ABI for rustfmt Signed-off-by: NotAShelf Change-Id: I8886d8c13a09231ad45f0a075e1308766a6a6964 --- .rustfmt.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 9d5c77e..ec5369d 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -2,7 +2,7 @@ condense_wildcard_suffixes = true doc_comment_code_block_width = 80 edition = "2024" # Keep in sync with Cargo.toml. enum_discrim_align_threshold = 60 -force_explicit_abi = false +force_explicit_abi = true force_multiline_blocks = true format_code_in_doc_comments = true format_macro_matchers = true