Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
akostylev0 committed Apr 10, 2024
1 parent 6863436 commit c0d95a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions adnl-tcp/src/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Deserializer {
impl Deserializer {
// TODO[akostylev0]
pub fn from_bytes(bytes: Vec<u8>) -> Self {
return Deserializer { input: bytes.into() }
Deserializer { input: bytes.into() }
}

pub fn verify_constructor_number(&mut self, crc32: u32) -> anyhow::Result<()> {
Expand All @@ -25,19 +25,19 @@ impl Deserializer {
}

pub fn parse_i32(&mut self) -> anyhow::Result<i32> {
return Ok(self.input.get_i32_le())
Ok(self.input.get_i32_le())
}

pub fn parse_i64(&mut self) -> anyhow::Result<i64> {
return Ok(self.input.get_i64_le())
Ok(self.input.get_i64_le())
}

pub fn parse_i256(&mut self) -> anyhow::Result<Int256> {
let mut needed = self.input.split_to(32);
let mut result: [u8; 32] = [0; 32];
needed.copy_to_slice(&mut result);

return Ok(result)
Ok(result)
}

pub fn parse_bytes(&mut self) -> anyhow::Result<crate::types::Bytes> {
Expand Down
5 changes: 2 additions & 3 deletions adnl-tcp/src/serializer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::error::Error;
use std::fmt::{Debug, Display};
use std::fmt::Debug;
use bytes::BufMut;
use crate::types::{Bytes, Int256};

Expand Down Expand Up @@ -44,7 +43,7 @@ impl Serializer {
self.output.put_slice(val);
}
} else {
let mut padding = (val.len() + 4) % 4;
let padding = (val.len() + 4) % 4;
if padding > 0 {
self.output.reserve(val.len() + 4 + 4 - padding);
self.output.put_u8(254);
Expand Down
8 changes: 3 additions & 5 deletions ton-liteserver-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use std::time::Duration;
use anyhow::{anyhow, Error};
use anyhow::anyhow;
use dashmap::DashMap;
use tower::Service;
use adnl_tcp::client::{AdnlTcpClient, ServerKey};
use futures::sink::Sink;
use futures::{FutureExt, SinkExt, StreamExt};
use futures::stream::SplitSink;
use rand::random;
use tokio::sync::mpsc::UnboundedSender;
use tokio::time::MissedTickBehavior;
Expand Down Expand Up @@ -89,7 +87,7 @@ impl<R : Requestable> Service<R> for LiteserverClient {
type Error = anyhow::Error;
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
if self.tx.is_closed() {
return Poll::Ready(Err(anyhow!("inner channel is closed")))
}
Expand Down Expand Up @@ -120,7 +118,7 @@ impl<R : Requestable> Service<R> for LiteserverClient {

let response = from_bytes::<R::Response>(response)?;

return Ok(response)
Ok(response)
}.boxed()
}
}
Expand Down
2 changes: 2 additions & 0 deletions ton-liteserver-client/src/tl.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

use adnl_tcp::deserializer::{Deserialize, Deserializer};
use adnl_tcp::serializer::{Serialize, Serializer};
pub use adnl_tcp::types::*;
Expand Down

0 comments on commit c0d95a3

Please sign in to comment.