Skip to content

Commit 87e2f65

Browse files
authored
address clippy 0.1.56 lints (#436)
1 parent cf5bf36 commit 87e2f65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+130
-153
lines changed

sdk/core/src/headers/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ pub fn add_optional_header2<T: AddAsHeader>(
7373
item: &Option<T>,
7474
request: &mut crate::Request,
7575
) -> Result<(), crate::errors::HTTPHeaderError> {
76-
Ok(if let Some(item) = item {
76+
if let Some(item) = item {
7777
item.add_as_header2(request)?
78-
})
78+
}
79+
Ok(())
7980
}
8081

8182
#[must_use]

sdk/core/src/headers/utilities.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ where
156156
T: std::str::FromStr,
157157
T::Err: Into<ParsingError>,
158158
{
159-
Ok(get_str_from_headers(headers, key)?
159+
get_str_from_headers(headers, key)?
160160
.parse()
161-
.map_err(|e: T::Err| Error::ParsingError(e.into()))?)
161+
.map_err(|e: T::Err| Error::ParsingError(e.into()))
162162
}
163163

164164
pub fn get_option_from_headers<T>(headers: &HeaderMap, key: &str) -> Result<Option<T>, Error>

sdk/core/src/http_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl HttpClient for reqwest::Client {
166166
request: &crate::Request,
167167
) -> Result<crate::Response, HttpError> {
168168
let mut reqwest_request = self.request(
169-
request.method().clone(),
169+
request.method(),
170170
url::Url::parse(&request.uri().to_string()).unwrap(),
171171
);
172172
for header in request.headers() {

sdk/core/src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#[macro_export]
2727
macro_rules! setters {
2828
(@single $name:ident : $typ:ty => $transform:expr) => {
29+
#[allow(clippy::redundant_field_names)]
30+
#[allow(clippy::needless_update)]
2931
// TODO: Declare using idiomatic with_$name when https://github.com/Azure/azure-sdk-for-rust/issues/292 is resolved.
3032
pub fn $name<T: ::std::convert::Into<$typ>>(self, $name: T) -> Self {
3133
let $name: $typ = $name.into();

sdk/core/src/policies/retry_policies/exponential_retry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ where
6565
Ok(response) => return Ok(response),
6666
Err(error) => {
6767
log::error!("Error occurred when making request: {}", error);
68-
if self.is_expired(&mut first_retry_time, &mut current_retries) {
68+
if self.is_expired(&mut first_retry_time, &current_retries) {
6969
return Err(error);
7070
} else {
7171
current_retries += 1;

sdk/core/src/policies/retry_policies/fixed_retry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ where
6464
Ok(response) => return Ok(response),
6565
Err(error) => {
6666
log::error!("Error occurred when making request: {}", error);
67-
if self.is_expired(&mut first_retry_time, &mut current_retries) {
67+
if self.is_expired(&mut first_retry_time, &current_retries) {
6868
return Err(error);
6969
} else {
7070
current_retries += 1;

sdk/core/src/policies/telemetry_policy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TelemetryPolicy {
3232
rustc_version: Option<&'a str>,
3333
options: &TelemetryOptions,
3434
) -> Self {
35-
const UNKNOWN: &'static str = "unknown";
35+
const UNKNOWN: &str = "unknown";
3636
let mut crate_name = crate_name.unwrap_or(UNKNOWN);
3737
let crate_version = crate_version.unwrap_or(UNKNOWN);
3838
let rustc_version = rustc_version.unwrap_or(UNKNOWN);

sdk/core/src/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl From<Box<dyn SeekableStream>> for Body {
2121
}
2222
}
2323

24-
const FIELDS: &'static [&'static str] = &["uri", "method", "headers", "body"];
24+
const FIELDS: &[&str] = &["uri", "method", "headers", "body"];
2525

2626
/// A pipeline request.
2727
///

sdk/core/src/request_options/delimiter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl<'a> Delimiter<'a> {
1111

1212
impl<'a> AppendToUrlQuery for Delimiter<'a> {
1313
fn append_to_url_query(&self, url: &mut url::Url) {
14-
url.query_pairs_mut().append_pair("delimiter", &self.0);
14+
url.query_pairs_mut().append_pair("delimiter", self.0);
1515
}
1616
}
1717

sdk/core/src/request_options/prefix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl<'a> Prefix<'a> {
1111

1212
impl<'a> AppendToUrlQuery for Prefix<'a> {
1313
fn append_to_url_query(&self, url: &mut url::Url) {
14-
url.query_pairs_mut().append_pair("prefix", &self.0);
14+
url.query_pairs_mut().append_pair("prefix", self.0);
1515
}
1616
}
1717

0 commit comments

Comments
 (0)