Skip to content

Fix new clippy warning #1002

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

Merged
merged 4 commits into from
Aug 11, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion eng/test/mock_transport/src/mock_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bytes::Bytes;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct MockResponse {
status: StatusCode,
headers: Headers,
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub type Result<T> = std::result::Result<T, Error>;
/// The kind of error
///
/// The classification of error is intentionally fairly coarse.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ErrorKind {
/// An HTTP status code that was not expected
HttpResponse {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/headers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub trait Header {
}

/// A collection of headers
#[derive(Clone, Debug, PartialEq, Default)]
#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub struct Headers(std::collections::HashMap<HeaderName, HeaderValue>);

impl Headers {
Expand Down
10 changes: 5 additions & 5 deletions sdk/core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ macro_rules! setters {
/// For the following code:
/// ```
/// # #[derive(Clone, Debug)]
/// # struct DatabaseClient;
/// # struct CreateCollectionResponse;
/// # pub struct DatabaseClient;
/// # pub struct CreateCollectionResponse;
/// azure_core::operation! {
/// CreateCollection,
/// client: DatabaseClient,
Expand All @@ -74,8 +74,8 @@ macro_rules! setters {
/// # use azure_core::setters;
/// # use azure_core::Context;
/// # #[derive(Clone, Debug)]
/// # struct DatabaseClient;
/// # struct CreateCollectionResponse;
/// # pub struct DatabaseClient;
/// # pub struct CreateCollectionResponse;
/// #[derive(Debug, Clone)]
/// pub struct CreateCollectionBuilder {
/// client: DatabaseClient,
Expand Down Expand Up @@ -396,7 +396,7 @@ macro_rules! request_option {
#[macro_export]
macro_rules! create_enum {
($name:ident, $(($variant:ident, $value:expr)), *) => (
#[derive(Debug, PartialEq, PartialOrd, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone, Copy)]
pub enum $name {
$(
$variant,
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl ClientOptions {
}

/// The algorithm to apply when calculating the delay between retry attempts.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RetryMode {
/// Retry attempts will delay based on a back-off strategy,
/// where each attempt will increase the duration that it waits before retrying.
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/pageable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<T, O> std::fmt::Debug for Pageable<T, O> {
}
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
enum State<T> {
Init,
Continuation(T),
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/content_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::str::FromStr;

const PREFIX: &str = "bytes ";

#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct ContentRange {
start: u64,
end: u64,
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/if_match_condition.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::headers::{self, Header};
use headers::{IF_MATCH, IF_NONE_MATCH};

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum IfMatchCondition {
Match(String),
NotMatch(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
};
use time::OffsetDateTime;

#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IfModifiedSinceCondition {
Modified(OffsetDateTime),
Unmodified(OffsetDateTime),
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/if_sequence_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{headers, Header};
/// Conditional request header based on the value of the object's sequence number
///
/// Ref: <https://docs.microsoft.com/en-us/rest/api/storageservices/put-page-from-url>
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IfSequenceNumber {
/// If the object's sequence number is less than the specified value, the
/// request proceeds; otherwise it fails with SequenceNumberConditionNotMet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::headers::{self, Header};

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum IfSourceMatchCondition {
Match(String),
NotMatch(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
};
use time::OffsetDateTime;

#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IfSourceModifiedSinceCondition {
Modified(OffsetDateTime),
Unmodified(OffsetDateTime),
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/lease.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::headers::{self, Header};
use std::str::FromStr;
use uuid::Uuid;

#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct LeaseId(Uuid);

impl std::fmt::Display for LeaseId {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/next_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::headers::{self, Headers};
use crate::AppendToUrlQuery;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NextMarker(String);

impl NextMarker {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::convert::From;
use std::fmt;
use std::str::FromStr;

#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Range {
pub start: u64,
pub end: u64,
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/request_options/source_lease_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::headers::{self, Header};
use std::str::FromStr;
use uuid::Uuid;

#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SourceLeaseId(Uuid);

impl std::fmt::Display for SourceLeaseId {
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/consistency_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::de::DeserializeOwned;
/// The consistency guarantee provided by Cosmos.
///
/// You can learn more about consistency levels in Cosmos [here](https://docs.microsoft.com/azure/cosmos-db/consistency-levels).
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ConsistencyLevel {
/// A linearizability guarantee
Strong,
Expand Down
4 changes: 2 additions & 2 deletions sdk/data_cosmos/src/operations/get_partition_key_ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl GetPartitionKeyRangesBuilder {
}
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GetPartitionKeyRangesResponse {
pub rid: String,
pub content_location: String,
Expand Down Expand Up @@ -111,7 +111,7 @@ impl GetPartitionKeyRangesResponse {
}
}

#[derive(Debug, PartialEq, PartialOrd, Clone, Deserialize)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone, Deserialize)]
pub struct PartitionKeyRange {
#[serde(rename = "_rid")]
pub rid: String,
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/operations/list_documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mod tests {
\"_count\": 7
}";

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct MyStruct {
id: String,
color: String,
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/operations/list_stored_procedures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl ListStoredProceduresResponse {
let (_status_code, headers, body) = response.deconstruct();
let body = body.collect().await?;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct Response {
pub _rid: String,
#[serde(rename = "StoredProcedures")]
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/operations/query_documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ where
}
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct QueryResponseMeta {
#[serde(rename = "_rid")]
pub rid: String,
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/resource_quota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use azure_core::error::{Error, ErrorKind};
/// A collection of this type is often returned in responses allowing you to
/// know how much of a given resource you can use.
#[allow(missing_docs)]
#[derive(Debug, Clone, PartialEq, PartialOrd)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)]
pub enum ResourceQuota {
Databases(u64),
StoredProcedures(u64),
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/resources/attachment.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Special documents that contain references and associated metadata to an external blob or media file.
///
/// You can find more information about attachments in Cosmos [here](https://docs.microsoft.com/rest/api/cosmos-db/attachments)
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
pub struct Attachment {
/// The attachment id
pub id: String,
Expand Down
18 changes: 9 additions & 9 deletions sdk/data_cosmos/src/resources/collection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use offer::Offer;
/// A container of JSON documents and associated JavaScript application logic.
///
/// You can learn more about Collections [here](https://docs.microsoft.com/rest/api/cosmos-db/collections).
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
pub struct Collection {
/// The collection id
pub id: String,
Expand Down Expand Up @@ -59,7 +59,7 @@ impl Resource for &Collection {
}
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
/// The type of index
pub enum KeyKind {
/// useful for equality comparisons
Expand All @@ -70,7 +70,7 @@ pub enum KeyKind {
Spatial,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
/// The datatype for which the indexing behavior is applied to
#[allow(missing_docs)]
pub enum DataType {
Expand All @@ -82,7 +82,7 @@ pub enum DataType {
}

/// The indexing mode
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum IndexingMode {
/// indexing occurs synchronously during insertion, replacment or deletion of documents
Expand All @@ -93,7 +93,7 @@ pub enum IndexingMode {

/// Path to be indexed
#[allow(missing_docs)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
pub struct IncludedPath {
pub path: String,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -102,7 +102,7 @@ pub struct IncludedPath {
}

/// An indexed description
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
pub struct IncludedPathIndex {
/// The datatype for which the indexing behavior is applied to
#[serde(rename = "dataType")]
Expand All @@ -114,7 +114,7 @@ pub struct IncludedPathIndex {
pub kind: KeyKind,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
/// Path that is excluded from indexing
pub struct ExcludedPath {
#[allow(missing_docs)]
Expand All @@ -127,7 +127,7 @@ impl From<String> for ExcludedPath {
}
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
/// The partitioning configuration settings for collection
pub struct PartitionKey {
/// An array of paths using which data within the collection can be partitioned
Expand Down Expand Up @@ -157,7 +157,7 @@ where
}
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialOrd, PartialEq, Eq)]
/// The indexing policy for a collection
#[serde(rename_all = "camelCase")]
pub struct IndexingPolicy {
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/resources/collection/offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use azure_core::Header;
/// The collection performance level.
///
/// It can either be custom or fixed. You can find more details [here](https://docs.microsoft.com/rest/api/cosmos-db/create-a-collection).
#[derive(Debug, Clone, PartialEq, Copy)]
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
pub enum Offer {
/// A Custom level of throughput
Throughput(u64),
Expand Down
2 changes: 1 addition & 1 deletion sdk/data_cosmos/src/resources/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::Resource;
/// A logical namespace for collections, users, and permissions.
///
/// You can learn more about Databases [here](https://docs.microsoft.com/rest/api/cosmos-db/databases).
#[derive(Serialize, Clone, PartialEq, PartialOrd, Deserialize, Debug)]
#[derive(Serialize, Clone, PartialEq, Eq, PartialOrd, Deserialize, Debug)]
pub struct Database {
/// The database id
pub id: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use azure_core::{prelude::IfMatchCondition, CollectedResponse};

/// A document's attributes
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq)]
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct DocumentAttributes {
#[serde(rename = "_rid")]
rid: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use azure_core::headers::{self, AsHeaders, HeaderValue};
use std::fmt;

/// Whether the resource should be included in the index.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IndexingDirective {
/// Follow the default indexing policy for the collection.
Default,
Expand Down
6 changes: 3 additions & 3 deletions sdk/data_cosmos/src/resources/document/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<T> Resource for &Document<T> {
}

/// Whether to query across partitions
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum QueryCrossPartition {
Yes,
Expand Down Expand Up @@ -115,7 +115,7 @@ impl Header for QueryCrossPartition {

/// Whether to parallelize across partitions
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ParallelizeCrossPartition {
Yes,
No,
Expand Down Expand Up @@ -151,7 +151,7 @@ impl Header for ParallelizeCrossPartition {
}

/// Whether the operation is an upsert
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum IsUpsert {
Yes,
Expand Down
4 changes: 2 additions & 2 deletions sdk/data_cosmos/src/resources/permission/permission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::borrow::Cow;
/// access to a specific resource. It is used to manage access to collections, documents,
/// attachments, stored procedures, triggers, and user-defined functions for a particular user.
/// You can learn more about permissions [here](https://docs.microsoft.com/rest/api/cosmos-db/permissions).
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Permission {
/// The unique name that identifies the permission.
pub id: String,
Expand Down Expand Up @@ -43,7 +43,7 @@ pub struct Permission {
pub permission_token: PermissionToken,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(tag = "permissionMode", content = "resource")]
/// The access mode on the resource for the user along with the full
/// addressable path of the resource associated with the permission
Expand Down
Loading