Fix compilers warnings (unused imports, unused fields, etc)

This commit is contained in:
Waffle 2019-09-13 00:58:08 +03:00
parent 7e297bb25e
commit 6e76d0441d
7 changed files with 33 additions and 21 deletions

View file

@ -9,7 +9,6 @@ use reqwest::{
StatusCode,
};
use serde::{de::DeserializeOwned, Serialize};
use serde_json::Value;
const TELEGRAM_API_URL: &str = "https://api.telegram.org";
@ -63,7 +62,7 @@ pub async fn request_multipart<T: DeserializeOwned>(
TelegramResponse::Err {
description,
error_code,
response_parameters,
response_parameters: _,
..
} => Err(RequestError::ApiError {
description,
@ -95,7 +94,7 @@ pub async fn request_json<T: DeserializeOwned, P: Serialize>(
TelegramResponse::Err {
description,
error_code,
response_parameters,
response_parameters: _,
..
} => Err(RequestError::ApiError {
description,
@ -108,11 +107,17 @@ pub async fn request_json<T: DeserializeOwned, P: Serialize>(
#[serde(untagged)]
enum TelegramResponse<R> {
Ok {
ok: bool, // true
/// Dummy field. Used for deserialization.
#[allow(dead_code)]
ok: bool, // TODO: True type
result: R,
},
Err {
ok: bool, // false
/// Dummy field. Used for deserialization.
#[allow(dead_code)]
ok: bool, // TODO: False type
description: String,
error_code: u16,
response_parameters: Option<ResponseParameters>,

View file

@ -6,7 +6,6 @@ use crate::core::{
};
use reqwest::r#async::multipart::Form;
use serde::Serialize;
/// This is a convenient struct that builds `reqwest::r#async::multipart::Form`
/// from scratch.

View file

@ -1,8 +1,11 @@
use crate::core::{
network,
requests::{
form_builder::FormBuilder, ChatId, Request, RequestContext,
RequestFuture, ResponseResult,
ChatId,
Request,
RequestFuture,
RequestContext,
ResponseResult,
},
types::Message,
};

View file

@ -1,8 +1,11 @@
use crate::core::{
network,
requests::{
form_builder::FormBuilder, ChatId, Request, RequestContext,
RequestFuture, ResponseResult,
ChatId,
Request,
RequestFuture,
RequestContext,
ResponseResult,
},
types::{Message, ParseMode, ReplyMarkup},
};

View file

@ -1,5 +1,3 @@
use std::path::Path;
use crate::core::{
network,
requests::{

View file

@ -1,12 +1,13 @@
use std::path::Path;
use crate::core::{
network,
requests::{
form_builder::FormBuilder, ChatId, Request, RequestContext,
RequestFuture, ResponseResult,
ChatId,
Request,
RequestFuture,
RequestContext,
ResponseResult,
},
types::{InlineKeyboardMarkup, Message, ParseMode},
types::{InlineKeyboardMarkup, Message},
};
/// Use this method to stop updating a live location message before live_period

View file

@ -1,9 +1,12 @@
use std::path::PathBuf;
use bytes::{Bytes, BytesMut};
use reqwest::r#async::multipart::Part;
use std::fs::File;
use std::path::PathBuf;
use tokio::codec::FramedRead;
use tokio::prelude::*;
use tokio::{
prelude::*,
codec::FramedRead,
};
struct FileDecoder;