Skip to content

Commit

Permalink
fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkMyCar committed Feb 21, 2024
1 parent 7da1e8c commit 69a1b0c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
10 changes: 2 additions & 8 deletions compact_str/src/features/proptest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
use alloc::string::String;

use proptest::arbitrary::{
Arbitrary,
StrategyFor,
};
use proptest::arbitrary::StrategyFor;
use proptest::prelude::*;
use proptest::strategy::{
MapInto,
Strategy,
};
use proptest::strategy::MapInto;
use proptest::string::StringParam;

use crate::CompactString;
Expand Down
35 changes: 29 additions & 6 deletions compact_str/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,33 @@ use alloc::boxed::Box;
use alloc::string::String;
#[doc(hidden)]
pub use core;
use core::borrow::{Borrow, BorrowMut};
use core::borrow::{
Borrow,
BorrowMut,
};
use core::cmp::Ordering;
use core::hash::{Hash, Hasher};
use core::hash::{
Hash,
Hasher,
};
use core::iter::FusedIterator;
use core::ops::{Add, AddAssign, Bound, Deref, DerefMut, RangeBounds};
use core::str::{FromStr, Utf8Error};
use core::{fmt, mem, slice};
use core::ops::{
Add,
AddAssign,
Bound,
Deref,
DerefMut,
RangeBounds,
};
use core::str::{
FromStr,
Utf8Error,
};
use core::{
fmt,
mem,
slice,
};
#[cfg(feature = "std")]
use std::ffi::OsStr;

Expand All @@ -32,7 +52,10 @@ mod repr;
use repr::Repr;

mod traits;
pub use traits::{CompactStringExt, ToCompactString};
pub use traits::{
CompactStringExt,
ToCompactString,
};

#[cfg(test)]
mod tests;
Expand Down
5 changes: 2 additions & 3 deletions compact_str/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use core::{

use proptest::collection::SizeRange;
use proptest::prelude::*;
use proptest::strategy::Strategy;
use test_case::test_case;
use test_strategy::proptest;

Expand Down Expand Up @@ -592,7 +591,7 @@ fn test_plus_operator() {
// String + &String
assert_eq!(String::from("a") + &("b".to_string()), "ab");
// String + &str
assert_eq!(String::from("a") + &"b", "ab");
assert_eq!(String::from("a") + "b", "ab");
}

#[allow(clippy::unnecessary_to_owned, clippy::op_ref)]
Expand Down Expand Up @@ -623,7 +622,7 @@ fn test_plus_operator_static_str() {
// String + &String
assert_eq!(String::from("a") + &("b".to_string()), "ab");
// String + &str
assert_eq!(String::from("a") + &"b", "ab");
assert_eq!(String::from("a") + "b", "ab");
}

#[test]
Expand Down

0 comments on commit 69a1b0c

Please sign in to comment.