Skip to content

Commit 7a10957

Browse files
committed
Prefer unwrap_or_else()
1 parent 252dea5 commit 7a10957

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/handlers/input.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn spotify_resource_id(base: &str, uri: &str, sep: &str, resource_type: &str) ->
119119
let id_string_with_query_params = uri.trim_start_matches(&uri_prefix);
120120
let query_idx = id_string_with_query_params
121121
.find('?')
122-
.unwrap_or(id_string_with_query_params.len());
122+
.unwrap_or_else(|| id_string_with_query_params.len());
123123
let id_string = id_string_with_query_params[0..query_idx].to_string();
124124
// If the lengths aren't equal, we must have found a match.
125125
let matched = id_string_with_query_params.len() != uri.len() && id_string.len() != uri.len();

0 commit comments

Comments
 (0)