Skip to content

Commit

Permalink
chore: clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nanov committed Nov 13, 2024
1 parent ee5feca commit bab7c92
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use scraper::selectable::Selectable;
use scraper::ElementRef;
use scraper::{Html, Selector};
use reqwest::{self, StatusCode};
use html2text;
use html2text::config;

use std::cell::LazyCell;
Expand Down Expand Up @@ -96,7 +95,7 @@ fn handle_suggestions(options_list: ElementRef) -> RaeResult {
use inquire::Select;

let suggestion_list = options_list
.select(&*&OPTIONS_SELECTOR)
.select(&OPTIONS_SELECTOR)
.filter_map(|x| x.text().next())
.collect::<Vec<&str>>();

Expand All @@ -112,7 +111,7 @@ fn handle_suggestions(options_list: ElementRef) -> RaeResult {
}

fn try_get_definition(page_core: ElementRef) -> RaeResult {
match page_core.select(&*RESULT_OR_SUGGESTION_SELECTOR).next() {
match page_core.select(&RESULT_OR_SUGGESTION_SELECTOR).next() {
Some(w) => match w.value().name() {
"article" => extract_definition(page_core),
"div" => handle_suggestions(w),
Expand All @@ -139,7 +138,7 @@ fn buschar_palabra(palabra: &str) -> RaeResult {
let raw_page = response.text()?;
let dom_fragment = Html::parse_document(&raw_page);

match dom_fragment.select(&*DIV_RESULTS_SELECTOR).next() {
match dom_fragment.select(&DIV_RESULTS_SELECTOR).next() {
Some(c) => try_get_definition(c),
_ => Err(RaeError::UnexpectedSiteStructure),
}
Expand All @@ -160,7 +159,7 @@ fn main() {
.get_one::<String>("palabra")
.unwrap(); // required so unwrap is safe

match buschar_palabra(&p) {
match buschar_palabra(p) {
Ok(s) => match s {
RaeSuccess::Definicion(d) => println!("{}", d),
RaeSuccess::NoEncontrado => println!("La palabra {} no está en el Diccionario.", p)
Expand Down

0 comments on commit bab7c92

Please sign in to comment.