From 0346fac62a79e4e83cb7ee3c8c0a0e5a1c5a7e25 Mon Sep 17 00:00:00 2001 From: fdai7374 Date: Thu, 2 Feb 2023 18:59:57 +0100 Subject: [PATCH] refactoring: reformat and import sort --- src/builtins/logout.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/builtins/logout.rs b/src/builtins/logout.rs index 261203c..dc5aee6 100644 --- a/src/builtins/logout.rs +++ b/src/builtins/logout.rs @@ -1,21 +1,21 @@ use crate::builtins::{Builtin, BuiltinConfig}; use crate::error::ShellError; -use system_shutdown::logout; use std::io; +use system_shutdown::logout; pub struct Logout; impl Builtin for Logout { fn execute(&mut self, _: &mut BuiltinConfig, _: Vec) -> Result<(), ShellError> { - let mut input = String::new(); + let mut input_confirmation = String::new(); println!("Are you sure? Unsaved data will be lost.\ny/n"); - io::stdin().read_line(&mut input).expect("Couldn't read form stdin"); - if input.chars().next().unwrap()=='y' { - match logout() { - Ok(_) => println!("Logging out"), - Err(error) => eprintln!("Failed to log out: {}", error), - } - }else {println!("Aborting");} + io::stdin().read_line(&mut input_confirmation).expect("Couldn't read form stdin"); + if input_confirmation.chars().next().unwrap() == 'y' { + match logout() { + Ok(_) => println!("Logging out"), + Err(error) => eprintln!("Failed to log out: {}", error), + } + } else { println!("Aborting"); } Ok(()) } } \ No newline at end of file