Skip to content

Commit

Permalink
address lints from clippy 1.72.0 (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
demoray authored Aug 28, 2023
1 parent fd707ca commit c0d938c
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion sdk/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ documentation = "https://docs.rs/azure_core"
keywords = ["sdk", "azure", "rest", "iot", "cloud"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.67.0"
rust-version = "1.70.0"

[dependencies]
async-trait = "0.1"
Expand Down
6 changes: 5 additions & 1 deletion sdk/core/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ mod tests {
use super::*;
use std::io;

#[allow(dead_code, unconditional_recursion)]
#[allow(
dead_code,
unconditional_recursion,
clippy::extra_unused_type_parameters
)]
fn ensure_send<T: Send>() {
ensure_send::<Error>();
}
Expand Down
1 change: 1 addition & 0 deletions sdk/core/src/http_client/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct NoopClient;
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl crate::HttpClient for NoopClient {
#[allow(clippy::diverging_sub_expression)]
async fn execute_request(&self, request: &crate::Request) -> crate::Result<crate::Response> {
panic!(
"A request was called on the default http client `NoopClient`.\
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage_blobs/examples/connection_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async fn main() -> azure_core::Result<()> {
let len = value?.blobs.blobs().count();
println!("received {len} blobs");
match cnt {
0 | 1 | 2 => assert_eq!(len, 3),
0..=2 => assert_eq!(len, 3),
3 => assert_eq!(len, 1),
_ => panic!("more than 10 entries??"),
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage_blobs/examples/list_blobs_00.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async fn main() -> azure_core::Result<()> {
let len = value?.blobs.blobs().count();
println!("received {len} blobs");
match cnt {
0 | 1 | 2 => assert_eq!(len, 3),
0..=2 => assert_eq!(len, 3),
3 => assert_eq!(len, 1),
_ => panic!("more than 10 entries??"),
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage_blobs/examples/list_blobs_01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async fn main() -> azure_core::Result<()> {
println!("\treceived {len} blobs");
match cnt {
// we added 21 blobs so 5x4 + 1
0 | 1 | 2 | 3 => assert_eq!(len, 5),
0..=3 => assert_eq!(len, 5),
4 => assert_eq!(len, 1),
_ => panic!("more than entries than expected!"),
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage_blobs/tests/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ async fn put_block_blob_and_get_properties() -> azure_core::Result<()> {

assert_eq!(blob_properties.blob.properties.content_length, 6);

let _ = requires_send_future(blob.get_properties().into_future());
requires_send_future(blob.get_properties().into_future()).await?;
container.delete().await?;
Ok(())
}
Expand Down Expand Up @@ -550,7 +550,7 @@ async fn set_blobtier() {
println!("container {} deleted!", container_name);
}

#[allow(dead_code)]
#[allow(dead_code, clippy::let_underscore_future)]
fn send_check() {
let client = initialize();
let blob = client.container_client("a").blob_client("b");
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage_blobs/tests/stream_list_blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async fn stream_list_blobs() {
let len = value.unwrap().blobs.blobs().count();
println!("received {} blobs", len);
match cnt {
0 | 1 | 2 => assert_eq!(len, 3),
0..=2 => assert_eq!(len, 3),
3 => assert_eq!(len, 1),
_ => panic!("more than 10 entries??"),
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/storage_datalake/src/clients/directory_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct DirectoryClient {
impl PathClient for DirectoryClient {
fn url(&self) -> azure_core::Result<Url> {
let fs_url = self.file_system_client.url()?;
let dir_path = vec![fs_url.path(), &self.dir_path].join("/");
let dir_path = [fs_url.path(), &self.dir_path].join("/");
Ok(self.file_system_client.url()?.join(&dir_path)?)
}

Expand All @@ -39,7 +39,7 @@ impl DirectoryClient {
pub fn list_paths(&self) -> ListPathsBuilder {
let fs_url = self.file_system_client.url().unwrap();
// the path will contain a leading '/' as we extract if from the path component of the url
let dir_path = vec![fs_url.path(), &self.dir_path].join("/");
let dir_path = [fs_url.path(), &self.dir_path].join("/");
ListPathsBuilder::new(self.file_system_client.clone())
.directory(dir_path)
.recursive(true)
Expand All @@ -63,7 +63,7 @@ impl DirectoryClient {
.get_directory_client(destination_path);
let fs_url = self.file_system_client.url().unwrap();
// the path will contain a leading '/' as we extract if from the path component of the url
let dir_path = vec![fs_url.path(), &self.dir_path].join("/");
let dir_path = [fs_url.path(), &self.dir_path].join("/");
RenamePathBuilder::new(destination_client)
.mode(PathRenameMode::Legacy)
.rename_source(dir_path)
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage_datalake/src/clients/file_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct FileClient {
impl PathClient for FileClient {
fn url(&self) -> azure_core::Result<Url> {
let fs_url = self.file_system_client.url()?;
let file_path = vec![fs_url.path(), &self.file_path].join("/");
let file_path = [fs_url.path(), &self.file_path].join("/");
Ok(self.file_system_client.url()?.join(&file_path)?)
}

Expand Down Expand Up @@ -69,7 +69,7 @@ impl FileClient {
let destination_client = self.file_system_client.get_file_client(destination_path);
let fs_url = self.file_system_client.url().unwrap();
// the path will contain a leading '/' as we extract if from the path component of the url
let file_path = vec![fs_url.path(), &self.file_path].join("/");
let file_path = [fs_url.path(), &self.file_path].join("/");
RenamePathBuilder::new(destination_client)
.mode(PathRenameMode::Legacy)
.rename_source(file_path)
Expand Down
2 changes: 2 additions & 0 deletions services/autorust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ members = [
"openapi",
"azure-autorust",
]

resolver = "2"
2 changes: 1 addition & 1 deletion services/autorust/codegen/src/crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn list_dirs_in(dir: impl AsRef<Utf8Path>) -> Result<Vec<Utf8PathBuf>> {

pub fn list_dirs() -> Result<Vec<Utf8PathBuf>> {
let mut names: Vec<_> = list_dirs_in("../mgmt")?.into_iter().collect();
names.extend(list_dirs_in("../svc")?.into_iter());
names.extend(list_dirs_in("../svc")?);
names.sort();
Ok(names)
}
Expand Down

0 comments on commit c0d938c

Please sign in to comment.