Skip to content

Commit 28b9412

Browse files
author
pioner921227
committed
refactoring
1 parent 4fdb4ef commit 28b9412

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

rust/fetcher-rust/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,13 @@ pub extern "C" fn rust_fetch(
5050
let code = res.status();
5151
let body = res.into_string().unwrap_or_default();
5252

53-
let is_ok = code < 400;
54-
5553
FetchResult {
56-
ok: is_ok,
54+
ok: code < 400,
5755
code: code.into(),
5856
body: CString::new(body).unwrap().into_raw(),
5957
}
6058
}
6159
Err(ureq::Error::Status(code, response)) => {
62-
// Здесь у нас есть Response и его body!
6360
let body = response
6461
.into_string()
6562
.unwrap_or_else(|_| "<no body>".to_string());
@@ -71,7 +68,6 @@ pub extern "C" fn rust_fetch(
7168
}
7269
Err(e) => {
7370
let msg = format!("Request error: {}", e);
74-
7571
FetchResult {
7672
ok: false,
7773
code: 0,

0 commit comments

Comments
 (0)