remove std::dbg uses

embed
Manos Pitsidianakis 2019-07-09 13:05:11 +03:00
parent 70e5949590
commit 93f3d6e230
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
5 changed files with 25 additions and 21 deletions

View File

@ -478,7 +478,7 @@ impl MaildirType {
continue 'entries; continue 'entries;
} }
if path.is_dir() { if path.is_dir() {
let path_children = std::dbg!(recurse_folders(folders, &path)); let path_children = recurse_folders(folders, &path);
if let Ok(f) = MaildirFolder::new( if let Ok(f) = MaildirFolder::new(
path.to_str().unwrap().to_string(), path.to_str().unwrap().to_string(),
path.file_name().unwrap().to_str().unwrap().to_string(), path.file_name().unwrap().to_str().unwrap().to_string(),

View File

@ -42,21 +42,27 @@ pub mod dbg {
} }
}; };
($val:expr) => { ($val:expr) => {
{
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
eprint!( // Use of `match` here is intentional because it affects the lifetimes
"[{:?}] {}:{}_{}: ", // of temporaries - https://stackoverflow.com/a/48732525/1063961
std::thread::current() match $val {
.name() tmp => {
.map(std::string::ToString::to_string) eprint!(
.unwrap_or_else(|| format!("{:?}", std::thread::current().id())), "[{:?}] {}:{}_{}: ",
file!(), std::thread::current()
line!(), .name()
column!() .map(std::string::ToString::to_string)
); .unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
eprintln!("{} = {:?}", stringify!($val), $val); file!(),
} line!(),
$val column!()
);
eprintln!("{} = {:?}", stringify!(tmp), tmp);
tmp
}
}
} else {
$val
} }
}; };
($fmt:literal, $($arg:tt)*) => { ($fmt:literal, $($arg:tt)*) => {

View File

@ -92,7 +92,7 @@ fn main() {
/* Poll on all channels. Currently we have the input channel for stdin, watching events and the signal watcher. */ /* Poll on all channels. Currently we have the input channel for stdin, watching events and the signal watcher. */
chan_select! { chan_select! {
receiver.recv() -> r => { receiver.recv() -> r => {
match std::dbg!(r.unwrap()) { match debug!(r.unwrap()) {
ThreadEvent::Input(Key::Ctrl('z')) => { ThreadEvent::Input(Key::Ctrl('z')) => {
state.switch_to_main_screen(); state.switch_to_main_screen();
//_thread_handler.join().expect("Couldn't join on the associated thread"); //_thread_handler.join().expect("Couldn't join on the associated thread");

View File

@ -491,8 +491,8 @@ impl Account {
} }
} }
debug!("didn't find {}", h); debug!("didn't find {}", h);
std::dbg!(&self.folders); debug!(&self.folders);
std::dbg!(&self.collection.envelopes); debug!(&self.collection.envelopes);
unreachable!() unreachable!()
} }
pub fn thread_to_mail_mut(&mut self, h: ThreadHash, f: FolderHash) -> &mut Envelope { pub fn thread_to_mail_mut(&mut self, h: ThreadHash, f: FolderHash) -> &mut Envelope {

View File

@ -130,8 +130,6 @@ impl UText {
}; };
self.cursor_dec(); self.cursor_dec();
self.content self.content.drain(offset..offset + graph_len).count();
.drain(std::dbg!(offset..offset + graph_len))
.count();
} }
} }