зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497356 - make NsresultExt.to_result() return Result<(), nsresult> r=froydnj
NsresultExt.to_result() is called by Rust code, so it would be more idiomatic for it to return Result<(), nsresult>, i.e. to return Ok(()) when the nsresult is NS_OK. This change makes it do so. MozReview-Commit-ID: EaMEKfonHhC Differential Revision: https://phabricator.services.mozilla.com/D10127 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e74056eacb
Коммит
239f128d8d
|
@ -14,7 +14,7 @@ pub struct nsresult(pub u32);
|
|||
pub trait NsresultExt {
|
||||
fn failed(self) -> bool;
|
||||
fn succeeded(self) -> bool;
|
||||
fn to_result(self) -> Result<nsresult, nsresult>;
|
||||
fn to_result(self) -> Result<(), nsresult>;
|
||||
|
||||
/// Get a printable name for the nsresult error code. This function returns
|
||||
/// a nsCString<'static>, which implements `Display`.
|
||||
|
@ -30,11 +30,11 @@ impl NsresultExt for nsresult {
|
|||
!self.failed()
|
||||
}
|
||||
|
||||
fn to_result(self) -> Result<nsresult, nsresult> {
|
||||
fn to_result(self) -> Result<(), nsresult> {
|
||||
if self.failed() {
|
||||
Err(self)
|
||||
} else {
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче