Skip to content

Try to implement sabr#335

Draft
FireMasterK wants to merge 2 commits intomainfrom
sabr-parsing
Draft

Try to implement sabr#335
FireMasterK wants to merge 2 commits intomainfrom
sabr-parsing

Conversation

@FireMasterK
Copy link
Copy Markdown
Member

This doesn't work yet.

use reqwest::{Body, Client, Method, Request, Url};
use serde_json::Value;
use std::error::Error;
use std::str::FromStr;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <unused_imports> reported by reviewdog 🐶
unused import: std::str::FromStr

.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|item| parse_format_id_from_json(item))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::redundant_closure reported by reviewdog 🐶
redundant closure

.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|item| parse_format_id_from_json(item))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::redundant_closure reported by reviewdog 🐶
redundant closure

.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|item| parse_buffered_range_from_json(item))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::redundant_closure reported by reviewdog 🐶
redundant closure

}

#[derive(Debug, Clone)]
pub struct Sequence {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
multiple fields are never read

}

#[derive(Debug, Clone)]
pub struct InitializedFormat {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
fields format_id, duration_ms, and sequence_count are never read

}

#[derive(Debug, Clone)]
pub struct SabrResponse {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
fields stream_protection_status, sabr_redirect, sabr_error, and next_request_policy are never read

}

#[derive(Debug)]
pub struct UmpPart {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
field size is never read

+ 16 * (byte2 as i32 + 256 * (byte3 as i32 + 256 * byte4 as i32))
}
_ => {
let value = u32::from_le_bytes([data[1], data[2], data[3], data[4]]) as i32;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::let_and_return reported by reviewdog 🐶
returning the result of a let binding from a block

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} has already been used", fd_pos).as_str())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} is not a Unix socket", fd_pos).as_str())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} has already been used", fd_pos).as_str())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} is not a TCP listener", fd_pos).as_str())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::io_other_error reported by reviewdog 🐶
this can be std::io::Error::other(_)

let resp = resp.map_err(|e| io::Error::new(ErrorKind::Other, e));


fn get_client_info_from_query(query: &QString) -> ClientInfo {
// Extract client info from query parameters
let client_name = query.get("c").and_then(|c| match c {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::bind_instead_of_map reported by reviewdog 🐶
using Option.and_then(|x| Some(y)), which is more succinctly expressed as map(|x| y)

pub buffered_ranges: Vec<BufferedRange>,
}

impl SabrRequestBuilder {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
methods with_resolution, with_visibility, and encode are never used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant