Fix new clippy lints (mostly clippy::blocks_in_conditions)
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>pull/354/head
parent
1048ce6824
commit
c332c2f5ff
|
@ -1973,7 +1973,7 @@ impl Component for Composer {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
match File::create_temp_file(&[], None, None, None, true)
|
||||
let res = File::create_temp_file(&[], None, None, None, true)
|
||||
.and_then(|f| {
|
||||
let std_file = f.as_std_file()?;
|
||||
Ok((
|
||||
|
@ -1985,8 +1985,8 @@ impl Component for Composer {
|
|||
.spawn()?,
|
||||
))
|
||||
})
|
||||
.and_then(|(f, child)| Ok((f, child.wait_with_output()?.stderr)))
|
||||
{
|
||||
.and_then(|(f, child)| Ok((f, child.wait_with_output()?.stderr)));
|
||||
match res {
|
||||
Ok((f, stderr)) => {
|
||||
if !stderr.is_empty() {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
|
|
|
@ -1441,7 +1441,7 @@ impl Component for EnvelopeView {
|
|||
let attachment_type = attachment.mime_type();
|
||||
let filename = attachment.filename();
|
||||
if let Ok(command) = query_default_app(&attachment_type) {
|
||||
match File::create_temp_file(
|
||||
let res = File::create_temp_file(
|
||||
&attachment.decode(Default::default()),
|
||||
filename.as_deref(),
|
||||
None,
|
||||
|
@ -1462,7 +1462,8 @@ impl Component for EnvelopeView {
|
|||
.stdout(Stdio::piped())
|
||||
.spawn()?,
|
||||
))
|
||||
}) {
|
||||
});
|
||||
match res {
|
||||
Ok((p, child)) => {
|
||||
context.temp_files.push(p);
|
||||
context.children.push(child);
|
||||
|
|
|
@ -324,7 +324,7 @@ impl ViewFilter {
|
|||
command
|
||||
};
|
||||
if let Some(command) = command {
|
||||
match File::create_temp_file(&_self.unfiltered, None, None, Some("html"), true)
|
||||
let res = File::create_temp_file(&_self.unfiltered, None, None, Some("html"), true)
|
||||
.and_then(|p| {
|
||||
let exec_cmd = desktop_exec_to_command(
|
||||
&command,
|
||||
|
@ -340,7 +340,8 @@ impl ViewFilter {
|
|||
.stdout(Stdio::piped())
|
||||
.spawn()?,
|
||||
))
|
||||
}) {
|
||||
});
|
||||
match res {
|
||||
Ok((p, child)) => {
|
||||
context
|
||||
.replies
|
||||
|
|
|
@ -928,7 +928,7 @@ impl State {
|
|||
|
||||
self.overlay.insert(new.id(), new);
|
||||
} else if matches!(action, Action::ReloadConfiguration) {
|
||||
match Settings::new().and_then(|new_settings| {
|
||||
let res = Settings::new().and_then(|new_settings| {
|
||||
let old_accounts = self
|
||||
.context
|
||||
.settings
|
||||
|
@ -961,7 +961,8 @@ impl State {
|
|||
return Err("No changes detected.".into());
|
||||
}
|
||||
Ok(Box::new(new_settings))
|
||||
}) {
|
||||
});
|
||||
match res {
|
||||
Ok(new_settings) => {
|
||||
let old_settings =
|
||||
std::mem::replace(&mut self.context.settings, new_settings);
|
||||
|
|
|
@ -428,7 +428,7 @@ pub mod sqlite3_m {
|
|||
return Ok(None);
|
||||
}
|
||||
|
||||
let ret: Vec<(UID, Envelope, Option<ModSequence>)> = match {
|
||||
let res = {
|
||||
let mut stmt = self.connection.prepare(
|
||||
"SELECT uid, envelope, modsequence FROM envelopes WHERE mailbox_hash = ?1;",
|
||||
)?;
|
||||
|
@ -445,7 +445,8 @@ pub mod sqlite3_m {
|
|||
})?
|
||||
.collect::<std::result::Result<_, _>>();
|
||||
x
|
||||
} {
|
||||
};
|
||||
let ret: Vec<(UID, Envelope, Option<ModSequence>)> = match res {
|
||||
Err(err) if matches!(&err, rusqlite::Error::FromSqlConversionFailure(_, _, _)) => {
|
||||
drop(err);
|
||||
self.reset()?;
|
||||
|
|
|
@ -850,8 +850,8 @@ mod alg {
|
|||
}
|
||||
|
||||
fn smawk(
|
||||
rows: &Vec<usize>,
|
||||
columns: &mut Vec<usize>,
|
||||
rows: &[usize],
|
||||
columns: &mut [usize],
|
||||
minima: &mut Vec<usize>,
|
||||
breaks: &mut Vec<usize>,
|
||||
width: usize,
|
||||
|
@ -879,7 +879,12 @@ mod alg {
|
|||
}
|
||||
let rows = &stack;
|
||||
if columns.len() > 1 {
|
||||
let mut odd_columns = columns.iter().skip(1).step_by(2).cloned().collect();
|
||||
let mut odd_columns = columns
|
||||
.iter()
|
||||
.skip(1)
|
||||
.step_by(2)
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
smawk(rows, &mut odd_columns, minima, breaks, width, offsets);
|
||||
for (i, o) in odd_columns.into_iter().enumerate() {
|
||||
columns[2 * i + 1] = o;
|
||||
|
@ -950,8 +955,8 @@ mod alg {
|
|||
let r = std::cmp::min(n, 2 * i);
|
||||
let edge = i + offset;
|
||||
smawk(
|
||||
&(offset..edge).collect(),
|
||||
&mut (edge..(r + offset)).collect(),
|
||||
&(offset..edge).collect::<Vec<_>>(),
|
||||
&mut (edge..(r + offset)).collect::<Vec<_>>(),
|
||||
&mut minima,
|
||||
&mut breaks,
|
||||
width,
|
||||
|
|
|
@ -106,24 +106,27 @@ impl HappyEyeballs {
|
|||
self.error.get_or_insert(error);
|
||||
}
|
||||
|
||||
// Initiate a fresh non-blocking TCP connection to `saddr`.
|
||||
//
|
||||
// Returns `AddOutcome::InProgress`.
|
||||
//
|
||||
// If there is an error concerning this particular connection
|
||||
// attempt, return `AddOutcome::Error` and the error code is
|
||||
// remembered in `self` if it is the first to occur; it will be
|
||||
// the one returned if no connection can be established at all.
|
||||
//
|
||||
// If the connection succeeds immediately, returns
|
||||
// `AddOutcome::Connected(stream)`. Because of non-blocking and
|
||||
// the way TCP works, this should *not* happen.
|
||||
/// Initiate a fresh non-blocking TCP connection to `saddr`.
|
||||
///
|
||||
/// Returns `AddOutcome::InProgress`.
|
||||
///
|
||||
/// If there is an error concerning this particular connection
|
||||
/// attempt, return `AddOutcome::Error` and the error code is
|
||||
/// remembered in `self` if it is the first to occur; it will be
|
||||
/// the one returned if no connection can be established at all.
|
||||
///
|
||||
/// If the connection succeeds immediately, returns
|
||||
/// `AddOutcome::Connected(stream)`. Because of non-blocking and
|
||||
/// the way TCP works, this should *not* happen.
|
||||
fn add(&mut self, saddr: SockAddr, domain: Domain) -> AddOutcome {
|
||||
let sock = match Socket::new(domain, socket2::Type::STREAM, Some(socket2::Protocol::TCP))
|
||||
.and_then(|sock| {
|
||||
sock.set_nonblocking(true)?;
|
||||
Ok(sock)
|
||||
}) {
|
||||
let set_nonblocking =
|
||||
Socket::new(domain, socket2::Type::STREAM, Some(socket2::Protocol::TCP)).and_then(
|
||||
|sock| {
|
||||
sock.set_nonblocking(true)?;
|
||||
Ok(sock)
|
||||
},
|
||||
);
|
||||
let sock = match set_nonblocking {
|
||||
Ok(sock) => sock,
|
||||
Err(e) => {
|
||||
self.set_error(e);
|
||||
|
|
Loading…
Reference in New Issue