Skip to content

Commit fee80bb

Browse files
authored
Merge pull request #332 from fox0/clippy--print_literal
ipcs: Fix clippy::print_literal
2 parents 040965c + 98d65a2 commit fee80bb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

sys/ipcs.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn display_message_queues(_args: &Args) {
7171
#[cfg(not(target_os = "macos"))]
7272
use std::ffi::CStr;
7373

74-
println!("Message Queues:");
74+
println!("{}", gettext("Message Queues:"));
7575
println!("T ID KEY MODE OWNER GROUP");
7676

7777
#[cfg(not(target_os = "macos"))]
@@ -142,7 +142,7 @@ fn display_shared_memory(_args: &Args) {
142142
return;
143143
}
144144

145-
println!("Shared Memory:");
145+
println!("{}", gettext("Shared Memory:"));
146146
println!("T ID KEY MODE OWNER GROUP");
147147

148148
for shmid in 0..=maxid {
@@ -190,7 +190,7 @@ fn display_semaphores(_args: &Args) {
190190
let mut semid: i32 = 0;
191191
let mut sem_ds: semid_ds = unsafe { std::mem::zeroed() };
192192

193-
println!("Semaphores:");
193+
println!("{}", gettext("Semaphores:"));
194194
println!("T ID KEY MODE OWNER GROUP NSEMS");
195195

196196
loop {
@@ -241,7 +241,10 @@ fn get_current_date() -> String {
241241
}
242242

243243
fn display_ipc_status(args: &Args) {
244-
println!("IPC status from {} as of {}", "source", get_current_date());
244+
println!(
245+
"{}",
246+
gettext!("IPC status from {} as of {}", "source", get_current_date())
247+
);
245248

246249
if args.message_queues {
247250
display_message_queues(args);
@@ -257,14 +260,14 @@ fn display_ipc_status(args: &Args) {
257260
}
258261

259262
fn main() -> Result<(), Box<dyn std::error::Error>> {
260-
// Parse command line arguments
261-
let mut args = Args::parse();
262-
263263
// Set locale and text domain for localization
264264
setlocale(LocaleCategory::LcAll, "");
265265
textdomain(PROJECT_NAME)?;
266266
bind_textdomain_codeset(PROJECT_NAME, "UTF-8")?;
267267

268+
// Parse command line arguments
269+
let mut args = Args::parse();
270+
268271
// Validate arguments and determine what to display
269272
if args.all {
270273
// Enable all options

0 commit comments

Comments
 (0)