Skip to content

Commit

Permalink
Merge pull request softprops#150 from softprops/fix-clippy-errors
Browse files Browse the repository at this point in the history
fix clippy errors
  • Loading branch information
softprops committed Jan 20, 2021
2 parents dc8ba09 + de4c777 commit 54dbf0c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ name: Main

on:
push:
paths-ignore:
- '*.md'
branches:
- master
tags:
- '**'
pull_request:
paths-ignore:
- '*.md'
branches:
- master

#env:
# CARGO_TERM_COLOR: always

jobs:
codestyle:
Expand Down
5 changes: 1 addition & 4 deletions dynomite/examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use dynomite::{
Attributes, DynamoDbExt, Item, Retries,
};
use futures::{future, TryStreamExt};
#[cfg(feature = "default")]
use rusoto_core_default::Region;
#[cfg(feature = "rustls")]
use rusoto_core_rustls::Region;
use rusoto_core::Region;
use std::{convert::TryFrom, error::Error};
use uuid::Uuid;

Expand Down
5 changes: 1 addition & 4 deletions dynomite/examples/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use dynomite::{
DynamoDbExt, Item, Retries,
};
use futures::{future, TryStreamExt};
#[cfg(feature = "default")]
use rusoto_core_default::Region;
#[cfg(feature = "rustls")]
use rusoto_core_rustls::Region;
use rusoto_core::Region;
use std::{convert::TryFrom, error::Error};
use uuid::Uuid;

Expand Down
36 changes: 18 additions & 18 deletions dynomite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,13 @@ pub trait Item: IntoAttributes + FromAttributes {
/// ```
pub trait Attribute: Sized {
/// Returns a conversion into an `AttributeValue`
fn into_attr(self: Self) -> AttributeValue;
fn into_attr(self) -> AttributeValue;
/// Returns a fallible conversion from an `AttributeValue`
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>;
}

impl Attribute for AttributeValue {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
self
}
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError> {
Expand Down Expand Up @@ -635,7 +635,7 @@ impl<A: Attribute> IntoAttributes for BTreeMap<String, A> {

/// A Map type for all hash-map-like values, represented as the `M` AttributeValue type
impl<T: IntoAttributes + FromAttributes> Attribute for T {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
let mut map = HashMap::new();
self.into_attrs(&mut map);
AttributeValue {
Expand All @@ -651,7 +651,7 @@ impl<T: IntoAttributes + FromAttributes> Attribute for T {
/// A `String` type for `Uuids`, represented by the `S` AttributeValue type
#[cfg(feature = "uuid")]
impl Attribute for Uuid {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
s: Some(self.to_hyphenated().to_string()),
..AttributeValue::default()
Expand All @@ -668,7 +668,7 @@ impl Attribute for Uuid {
/// An `rfc3339` formatted version of `DateTime<Utc>`, represented by the `S` AttributeValue type
#[cfg(feature = "chrono")]
impl Attribute for DateTime<Utc> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
s: Some(self.to_rfc3339()),
..Default::default()
Expand All @@ -690,7 +690,7 @@ impl Attribute for DateTime<Utc> {
/// An `rfc3339` formatted version of `DateTime<Local>`, represented by the `S` AttributeValue type
#[cfg(feature = "chrono")]
impl Attribute for DateTime<Local> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
s: Some(self.to_rfc3339()),
..Default::default()
Expand All @@ -712,7 +712,7 @@ impl Attribute for DateTime<Local> {
/// An `rfc3339` formatted version of `DateTime<FixedOffset>`, represented by the `S` AttributeValue type
#[cfg(feature = "chrono")]
impl Attribute for DateTime<FixedOffset> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
s: Some(self.to_rfc3339()),
..Default::default()
Expand All @@ -732,7 +732,7 @@ impl Attribute for DateTime<FixedOffset> {
/// An `rfc3339` formatted version of `SystemTime`, represented by the `S` AttributeValue type
#[cfg(feature = "chrono")]
impl Attribute for SystemTime {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
let dt: DateTime<Utc> = self.into();
dt.into_attr()
}
Expand All @@ -749,7 +749,7 @@ impl Attribute for SystemTime {

/// A `String` type, represented by the S AttributeValue type
impl Attribute for String {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
s: Some(self),
..AttributeValue::default()
Expand All @@ -761,7 +761,7 @@ impl Attribute for String {
}

impl<'a> Attribute for Cow<'a, str> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
s: Some(match self {
Cow::Owned(o) => o,
Expand All @@ -778,7 +778,7 @@ impl<'a> Attribute for Cow<'a, str> {
/// A String Set type, represented by the SS AttributeValue type
#[allow(clippy::implicit_hasher)]
impl Attribute for HashSet<String> {
fn into_attr(mut self: Self) -> AttributeValue {
fn into_attr(mut self) -> AttributeValue {
AttributeValue {
ss: Some(self.drain().collect()),
..AttributeValue::default()
Expand All @@ -793,7 +793,7 @@ impl Attribute for HashSet<String> {
}

impl Attribute for BTreeSet<String> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
ss: Some(self.into_iter().collect()),
..AttributeValue::default()
Expand All @@ -810,7 +810,7 @@ impl Attribute for BTreeSet<String> {
/// A Binary Set type, represented by the BS AttributeValue type
#[allow(clippy::implicit_hasher)]
impl Attribute for HashSet<Vec<u8>> {
fn into_attr(mut self: Self) -> AttributeValue {
fn into_attr(mut self) -> AttributeValue {
AttributeValue {
bs: Some(self.drain().map(Bytes::from).collect()),
..AttributeValue::default()
Expand All @@ -826,7 +826,7 @@ impl Attribute for HashSet<Vec<u8>> {

// a Boolean type, represented by the BOOL AttributeValue type
impl Attribute for bool {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
bool: Some(self),
..AttributeValue::default()
Expand All @@ -839,7 +839,7 @@ impl Attribute for bool {

// a Binary type, represented by the B AttributeValue type
impl Attribute for bytes::Bytes {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
b: Some(self),
..AttributeValue::default()
Expand All @@ -852,7 +852,7 @@ impl Attribute for bytes::Bytes {

// a Binary type, represented by the B AttributeValue type
impl Attribute for Vec<u8> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
AttributeValue {
b: Some(self.into()),
..AttributeValue::default()
Expand All @@ -875,7 +875,7 @@ impl Attribute for Vec<u8> {
/// and implement `Attribute` for `YourType`. An `Vec<YourType>` implementation
/// will already be provided
impl<A: Attribute> Attribute for Vec<A> {
fn into_attr(mut self: Self) -> AttributeValue {
fn into_attr(mut self) -> AttributeValue {
AttributeValue {
l: Some(self.drain(..).map(|s| s.into_attr()).collect()),
..AttributeValue::default()
Expand All @@ -892,7 +892,7 @@ impl<A: Attribute> Attribute for Vec<A> {
}

impl<T: Attribute> Attribute for Option<T> {
fn into_attr(self: Self) -> AttributeValue {
fn into_attr(self) -> AttributeValue {
match self {
Some(value) => value.into_attr(),
_ => AttributeValue {
Expand Down

0 comments on commit 54dbf0c

Please sign in to comment.