refactor: various code quality enhancements using clippy

This commit is contained in:
Muhammad Nauman Raza 2024-05-28 15:50:43 +01:00
parent 12c0c020a9
commit 0696a14f52
3 changed files with 14 additions and 16 deletions

View file

@ -19,9 +19,8 @@ pub struct Search {
}
pub async fn query_anime(query: String) -> Result<Search, reqwest::Error> {
let resp = reqwest::get(format!("https://altoku-api.vercel.app/anime/gogoanime/{}?page=1", query))
reqwest::get(format!("https://altoku-api.vercel.app/anime/gogoanime/{}?page=1", query))
.await.expect("Failed to get from API")
.json::<Search>()
.await;
return resp;
.await
}

View file

@ -18,7 +18,7 @@ pub async fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<
}
}
KeyCode::Enter => {
query_anime(app.input.to_string()).await.unwrap().currentPage;
query_anime(app.input.to_string()).await.unwrap();
app.input.reset();
}
_ => {

View file

@ -22,8 +22,7 @@ pub fn render(app: &mut App, frame: &mut Frame) {
)
.split(frame.size());
let mut text: Vec<Line> = vec![];
text.push(
let text: Vec<Line> = vec![
Line::from(vec![
"Press ".into(),
"Esc".bold(),
@ -33,7 +32,7 @@ pub fn render(app: &mut App, frame: &mut Frame) {
"Enter".bold(),
" to submit your query.".into(),
]),
);
];
let help_message = Paragraph::new(text);
frame.render_widget(help_message, chunks[0]);