refactor: various code quality enhancements using clippy
This commit is contained in:
parent
8b6213f604
commit
7f50f147b6
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
_ => {
|
||||
|
|
23
src/ui.rs
23
src/ui.rs
|
@ -22,18 +22,17 @@ pub fn render(app: &mut App, frame: &mut Frame) {
|
|||
)
|
||||
.split(frame.size());
|
||||
|
||||
let mut text: Vec<Line> = vec![];
|
||||
text.push(
|
||||
Line::from(vec![
|
||||
"Press ".into(),
|
||||
"Esc".bold(),
|
||||
" or ".into(),
|
||||
"Ctrl+C".bold(),
|
||||
" to quit, and ".into(),
|
||||
"Enter".bold(),
|
||||
" to submit your query.".into(),
|
||||
]),
|
||||
);
|
||||
let text: Vec<Line> = vec![
|
||||
Line::from(vec![
|
||||
"Press ".into(),
|
||||
"Esc".bold(),
|
||||
" or ".into(),
|
||||
"Ctrl+C".bold(),
|
||||
" to quit, and ".into(),
|
||||
"Enter".bold(),
|
||||
" to submit your query.".into(),
|
||||
]),
|
||||
];
|
||||
let help_message = Paragraph::new(text);
|
||||
frame.render_widget(help_message, chunks[0]);
|
||||
|
||||
|
|
Reference in a new issue