Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to Rust 1.59 #1227

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.58-buster as builder
FROM rust:1.59-buster as builder
WORKDIR /app
ADD . /app
ENV PATH=$PATH:/root/.cargo/bin
Expand Down
26 changes: 13 additions & 13 deletions src/db/tests/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async fn get_bsos_limit_offset() -> Result<()> {
0,
Sorting::Index,
0,
&"0".to_owned(),
"0",
))
.await?;
assert!(bsos.items.is_empty());
Expand All @@ -147,7 +147,7 @@ async fn get_bsos_limit_offset() -> Result<()> {
0,
Sorting::Index,
-1,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), size as usize);
Expand Down Expand Up @@ -254,7 +254,7 @@ async fn get_bsos_newer() -> Result<()> {
timestamp as u64 - 30,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 3);
Expand All @@ -271,7 +271,7 @@ async fn get_bsos_newer() -> Result<()> {
timestamp as u64 - 20,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 2);
Expand All @@ -287,7 +287,7 @@ async fn get_bsos_newer() -> Result<()> {
timestamp as u64 - 10,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 1);
Expand All @@ -302,7 +302,7 @@ async fn get_bsos_newer() -> Result<()> {
timestamp as u64,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 0);
Expand Down Expand Up @@ -338,7 +338,7 @@ async fn get_bsos_sort() -> Result<()> {
0,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 3);
Expand All @@ -355,7 +355,7 @@ async fn get_bsos_sort() -> Result<()> {
0,
Sorting::Oldest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 3);
Expand All @@ -372,7 +372,7 @@ async fn get_bsos_sort() -> Result<()> {
0,
Sorting::Index,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 3);
Expand Down Expand Up @@ -550,7 +550,7 @@ async fn delete_collection_tombstone() -> Result<()> {
assert!(result.is_none());
}
// make sure coll BSOs were *not* deleted
let result = db.get_bso(gbso(uid, coll, &bid1.to_string())).await?;
let result = db.get_bso(gbso(uid, coll, bid1)).await?;
assert!(result.is_some());
Ok(())
}
Expand Down Expand Up @@ -887,7 +887,7 @@ async fn get_bsos() -> Result<()> {
0,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(ids.items, vec!["b0", "b1", "b2", "b3", "b4"]);
Expand All @@ -901,7 +901,7 @@ async fn get_bsos() -> Result<()> {
0,
Sorting::Newest,
10,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 3);
Expand All @@ -918,7 +918,7 @@ async fn get_bsos() -> Result<()> {
0,
Sorting::Index,
2,
&"0".to_owned(),
"0",
))
.await?;
assert_eq!(bsos.items.len(), 2);
Expand Down
4 changes: 2 additions & 2 deletions src/tokenserver/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl FromRequest for TokenData {
.map_err(|_| TokenserverError::unauthorized("Unauthorized"))?;

// The request must use Bearer auth
if let Some((auth_type, _)) = authorization_header.split_once(" ") {
if let Some((auth_type, _)) = authorization_header.split_once(' ') {
if auth_type.to_ascii_lowercase() != "bearer" {
return Err(TokenserverError::unauthorized("Unsupported").into());
}
Expand Down Expand Up @@ -381,7 +381,7 @@ impl FromRequest for KeyId {
.map_err(|_| TokenserverError::invalid_key_id("Invalid X-KeyID header"))?;

let (keys_changed_at_string, encoded_client_state) = x_key_id
.split_once("-")
.split_once('-')
.ok_or_else(|| TokenserverError::invalid_credentials("Unauthorized"))?;

let client_state = {
Expand Down
2 changes: 1 addition & 1 deletion src/web/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn get_accepted(req: &HttpRequest, accepted: &[&str], default: &'static str) ->
.partial_cmp(&a.quality)
.unwrap_or(std::cmp::Ordering::Equal)
});
for qitem in candidates.to_vec() {
for qitem in candidates.iter().cloned() {
if qitem.item == STAR_STAR {
return default.to_owned();
}
Expand Down
2 changes: 1 addition & 1 deletion src/web/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ where
.into_iter()
.map(|v| serde_json::to_string(&v).unwrap_or_else(|_| "".to_string()))
.filter(|v| !v.is_empty())
.map(|v| v.replace("\n", "\\u000a") + "\n")
.map(|v| v.replace('\n', "\\u000a") + "\n")
.collect();

Ok(resp
Expand Down