mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-02 18:15:37 +00:00
apply some clippy corrections
This commit is contained in:
parent
d6dc4d6870
commit
1d4dc50380
4 changed files with 18 additions and 21 deletions
|
|
@ -43,7 +43,7 @@ impl Meta {
|
||||||
match buffer.get(..if len > MAX_LEN { MAX_LEN } else { len }) {
|
match buffer.get(..if len > MAX_LEN { MAX_LEN } else { len }) {
|
||||||
Some(slice) => {
|
Some(slice) => {
|
||||||
// Parse data
|
// Parse data
|
||||||
let data = Data::from_utf8(&slice);
|
let data = Data::from_utf8(slice);
|
||||||
|
|
||||||
if let Err(reason) = data {
|
if let Err(reason) = data {
|
||||||
return Err((
|
return Err((
|
||||||
|
|
@ -57,7 +57,7 @@ impl Meta {
|
||||||
|
|
||||||
// MIME
|
// MIME
|
||||||
|
|
||||||
let mime = Mime::from_utf8(&slice);
|
let mime = Mime::from_utf8(slice);
|
||||||
|
|
||||||
if let Err(reason) = mime {
|
if let Err(reason) = mime {
|
||||||
return Err((
|
return Err((
|
||||||
|
|
@ -72,7 +72,7 @@ impl Meta {
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
|
|
||||||
let status = Status::from_utf8(&slice);
|
let status = Status::from_utf8(slice);
|
||||||
|
|
||||||
if let Err(reason) = status {
|
if let Err(reason) = status {
|
||||||
return Err((
|
return Err((
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,8 @@ pub fn from_stream_async(
|
||||||
base_io_stream,
|
base_io_stream,
|
||||||
cancelable,
|
cancelable,
|
||||||
priority,
|
priority,
|
||||||
bytes_in_chunk,
|
(bytes_in_chunk, bytes_total_limit, 0),
|
||||||
bytes_total_limit,
|
(on_chunk, on_complete),
|
||||||
0, // initial `bytes_total` value
|
|
||||||
on_chunk,
|
|
||||||
on_complete,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,12 +40,15 @@ pub fn read_all_from_stream_async(
|
||||||
base_io_stream: impl IsA<IOStream>,
|
base_io_stream: impl IsA<IOStream>,
|
||||||
cancelable: Option<Cancellable>,
|
cancelable: Option<Cancellable>,
|
||||||
priority: Priority,
|
priority: Priority,
|
||||||
bytes_in_chunk: usize,
|
bytes: (usize, usize, usize),
|
||||||
bytes_total_limit: usize,
|
callback: (
|
||||||
bytes_total: usize,
|
impl Fn((Bytes, usize)) + 'static,
|
||||||
on_chunk: impl Fn((Bytes, usize)) + 'static,
|
impl FnOnce(Result<MemoryInputStream, (Error, Option<&str>)>) + 'static,
|
||||||
on_complete: impl FnOnce(Result<MemoryInputStream, (Error, Option<&str>)>) + 'static,
|
),
|
||||||
) {
|
) {
|
||||||
|
let (on_chunk, on_complete) = callback;
|
||||||
|
let (bytes_in_chunk, bytes_total_limit, bytes_total) = bytes;
|
||||||
|
|
||||||
base_io_stream.input_stream().read_bytes_async(
|
base_io_stream.input_stream().read_bytes_async(
|
||||||
bytes_in_chunk,
|
bytes_in_chunk,
|
||||||
priority,
|
priority,
|
||||||
|
|
@ -80,11 +80,8 @@ pub fn read_all_from_stream_async(
|
||||||
base_io_stream,
|
base_io_stream,
|
||||||
cancelable,
|
cancelable,
|
||||||
priority,
|
priority,
|
||||||
bytes_in_chunk,
|
(bytes_in_chunk, bytes_total_limit, bytes_total),
|
||||||
bytes_total_limit,
|
(on_chunk, on_complete),
|
||||||
bytes_total,
|
|
||||||
on_chunk,
|
|
||||||
on_complete,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(reason) => {
|
Err(reason) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue