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:
Myk Melez 2018-10-29 22:35:23 +00:00
Родитель e74056eacb
Коммит 239f128d8d
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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(())
}
}