refactor: clean up unwrap and clone (#17282)

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
This commit is contained in:
Yiyu Lin 2023-01-15 12:06:46 +08:00 committed by GitHub
parent 05ef925eb0
commit fd85f840cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 75 additions and 94 deletions

View file

@ -53,7 +53,7 @@ pub fn resolve_redirect_from_response(
) -> Result<Url, AnyError> {
debug_assert!(response.status().is_redirection());
if let Some(location) = response.headers().get(LOCATION) {
let location_string = location.to_str().unwrap();
let location_string = location.to_str()?;
log::debug!("Redirecting to {:?}...", &location_string);
let new_url = resolve_url_from_location(request_url, location_string);
Ok(new_url)