Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
error: use of `.unwrap_or_else(..)` to construct default value
  --> src/http.rs:73:16
   |
73 |     let resp = get_html_section(&resp, "main").unwrap_or_else(|| "".to_string());
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `get_html_section(&resp, "main").unwrap_or_default()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_else_default

error: use of `.unwrap_or_else(..)` to construct default value
  --> src/http.rs:37:17
   |
37 |     let brief = get_html_section(&brief, "main").unwrap_or_else(|| "".to_string());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `get_html_section(&brief, "main").unwrap_or_default()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_else_default
   = note: `-D clippy::unwrap-or-else-default` implied by `-D warnings`
  • Loading branch information
nuxeh committed Dec 19, 2022
1 parent a017c4e commit 06d3a5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn get_content(aoc: &Aoc, suffix: &str) -> Result<String, Error> {
pub fn get_brief(aoc: &Aoc) -> Result<(String, String), Error> {
let brief = get_content(aoc, "")?;
let title = get_title(&brief).unwrap_or_default();
let brief = get_html_section(&brief, "main").unwrap_or_else(|| "".to_string());
let brief = get_html_section(&brief, "main").unwrap_or_default();
let brief = parse_html(&brief);
let num_lines = brief.lines().count();
let brief = brief.lines()
Expand Down Expand Up @@ -70,7 +70,7 @@ pub fn submit(aoc: &Aoc, solution: &str) -> Result<String, Error> {
])?
.into_string()?;

let resp = get_html_section(&resp, "main").unwrap_or_else(|| "".to_string());
let resp = get_html_section(&resp, "main").unwrap_or_default();
let resp = parse_html(&resp);
let resp = resp.trim().to_string();
Ok(resp)
Expand Down

0 comments on commit 06d3a5b

Please sign in to comment.