Skip to content

Commit f41dc19

Browse files
committed
style: fix io::Error::other
1 parent dc4976a commit f41dc19

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/backend/android.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct IoErrorWrapper(io::Error);
2121

2222
impl From<jni::errors::Error> for IoErrorWrapper {
2323
fn from(value: jni::errors::Error) -> Self {
24-
IoErrorWrapper(io::Error::other(value))
24+
IoErrorWrapper(io::Error::new(io::ErrorKind::Other, value))
2525
}
2626
}
2727
impl From<io::Error> for IoErrorWrapper {
@@ -110,7 +110,10 @@ impl Android {
110110
);
111111

112112
let java_class = JAVA_CLASS.get().ok_or_else(|| {
113-
io::Error::other("Android activity not set. Call Android::initialize* first.")
113+
io::Error::new(
114+
io::ErrorKind::Other,
115+
"Android activity not set. Call Android::initialize* first.",
116+
)
114117
})?;
115118
JavaVM::singleton()?.attach_current_thread(|env| -> Result<(), IoErrorWrapper> {
116119
let title = env.new_string(input.title.as_deref().unwrap_or(DEFAULT_TITLE))?;
@@ -151,7 +154,7 @@ impl Android {
151154
.l()?;
152155
if !result.is_null() {
153156
let result = JString::cast_local(env, result)?;
154-
Err(io::Error::other(result.to_string()).into())
157+
Err(io::Error::new(io::ErrorKind::Other, result.to_string()).into())
155158
} else {
156159
Ok(())
157160
}

src/backend/ios.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ impl Backend for IOS {
7979
) -> io::Result<()> {
8080
let callback = Arc::new(Mutex::new(Some(callback)));
8181

82-
let mtm = MainThreadMarker::new()
83-
.ok_or_else(|| io::Error::other("IOS backend can only be used on main thread"))?;
82+
let mtm = MainThreadMarker::new().ok_or_else(|| {
83+
io::Error::new(
84+
io::ErrorKind::Other,
85+
"IOS backend can only be used on main thread",
86+
)
87+
})?;
8488

8589
let title = input.title.as_deref().unwrap_or(DEFAULT_TITLE);
8690
let prompt_ns = input.prompt.as_deref().map(NSString::from_str);
@@ -215,7 +219,8 @@ impl Backend for IOS {
215219
alert.addAction(&ok_action);
216220

217221
let top_vc = Self::get_top_view_controller(mtm).ok_or_else(|| {
218-
io::Error::other(
222+
io::Error::new(
223+
io::ErrorKind::Other,
219224
"no active window or view controller found to present the input dialog",
220225
)
221226
})?;

0 commit comments

Comments
 (0)