Genericised From<T>
trait impl for Error types
- Error type in the error module now implements a broadly generic From<T> impl for error conversion into the pacwrap-core library's Error type. - `ErrorGeneric::prepend` and `ErrorGeneric::prepend_io` both now accept borrowed or heap-allocated String return types without additional sugar. - A lone unary postfix operator has been applied to external function calls where deemed most appropriate, removing unnecessary function calls to `ErrorGeneric::prepend` and `ErrorGeneric::prepend_io`.
This commit is contained in:
parent
6e5bb8df5a
commit
f20f46b28e
17 changed files with 119 additions and 111 deletions
|
@ -47,7 +47,6 @@ use crate::{
|
|||
},
|
||||
utils::prompt::prompt,
|
||||
Error,
|
||||
ErrorGeneric,
|
||||
Result,
|
||||
};
|
||||
|
||||
|
@ -79,7 +78,7 @@ impl Transaction for Commit {
|
|||
let state = self.state.as_str();
|
||||
|
||||
if let SyncState::NotRequired = handle.trans_ready(ag.action(), ag.flags())? {
|
||||
handle.alpm_mut().trans_release().generic()?;
|
||||
handle.alpm_mut().trans_release()?;
|
||||
|
||||
return Ok(match ready_state(ag.action(), &self.state) {
|
||||
Some(state) => state,
|
||||
|
@ -138,7 +137,7 @@ fn confirm(
|
|||
println!("{}", sum);
|
||||
|
||||
if ag.flags().contains(TransactionFlags::PREVIEW) {
|
||||
handle.alpm_mut().trans_release().generic()?;
|
||||
handle.alpm_mut().trans_release()?;
|
||||
return Ok(State::Next(next_state(ag.action(), state, false)));
|
||||
}
|
||||
|
||||
|
@ -147,13 +146,13 @@ fn confirm(
|
|||
let query = format!("Proceed with {action}?");
|
||||
|
||||
if !prompt("::", format!("{}{query}{}", *BOLD, *RESET), true)? {
|
||||
handle.alpm_mut().trans_release().generic()?;
|
||||
handle.alpm_mut().trans_release()?;
|
||||
return Ok(State::Next(next_state(ag.action(), state, false)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handle.alpm_mut().trans_release().generic()?;
|
||||
handle.alpm_mut().trans_release()?;
|
||||
Ok(State::Commit(sum.download()))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue