Skip to content

Commit 9c679e4

Browse files
committed
Prefer as_str over &[..]
1 parent 924fb22 commit 9c679e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/category.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn index(req: &mut Request) -> CargoResult<Response> {
118118
let conn = try!(req.tx());
119119
let (offset, limit) = try!(req.pagination(10, 100));
120120
let query = req.query();
121-
let sort = query.get("sort").map(|s| &s[..]).unwrap_or("alpha");
121+
let sort = query.get("sort").map_or("alpha", String::as_str);
122122
let sort_sql = match sort {
123123
"crates" => "ORDER BY crates_cnt DESC",
124124
_ => "ORDER BY category ASC",

0 commit comments

Comments
 (0)