Skip to content

run rustfmt on libcollections module #33966

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

Closed
wants to merge 1 commit into from
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,9 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
impl<'a, T> IntoIterator for &'a BinaryHeap<T>
where T: Ord
{
type Item = &'a T;
type IntoIter = Iter<'a, T>;

Expand Down
36 changes: 25 additions & 11 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ pub trait ToOwned {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ToOwned for T where T: Clone {
impl<T> ToOwned for T
where T: Clone
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the parenthesis going back to line? That's quite ugly. :-/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(rustfmt bug again)

I think this is intentional though, since the where clause was indented

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intentional - we do this by hand with where clauses too

type Owned = T;
fn to_owned(&self) -> T {
self.clone()
Expand Down Expand Up @@ -107,17 +109,19 @@ pub enum Cow<'a, B: ?Sized + 'a>
{
/// Borrowed data.
#[stable(feature = "rust1", since = "1.0.0")]
Borrowed(#[stable(feature = "rust1", since = "1.0.0")] &'a B),
Borrowed(#[stable(feature = "rust1", since = "1.0.0")]
&'a B),

/// Owned data.
#[stable(feature = "rust1", since = "1.0.0")]
Owned(
#[stable(feature = "rust1", since = "1.0.0")] <B as ToOwned>::Owned
),
Owned(#[stable(feature = "rust1", since = "1.0.0")]
<B as ToOwned>::Owned),
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> Clone for Cow<'a, B> where B: ToOwned {
impl<'a, B: ?Sized> Clone for Cow<'a, B>
where B: ToOwned
{
fn clone(&self) -> Cow<'a, B> {
match *self {
Borrowed(b) => Borrowed(b),
Expand All @@ -129,7 +133,9 @@ impl<'a, B: ?Sized> Clone for Cow<'a, B> where B: ToOwned {
}
}

impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
impl<'a, B: ?Sized> Cow<'a, B>
where B: ToOwned
{
/// Acquires a mutable reference to the owned form of the data.
///
/// Clones the data if it is not already owned.
Expand Down Expand Up @@ -181,7 +187,9 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> Deref for Cow<'a, B> where B: ToOwned {
impl<'a, B: ?Sized> Deref for Cow<'a, B>
where B: ToOwned
{
type Target = B;

fn deref(&self) -> &B {
Expand All @@ -196,7 +204,9 @@ impl<'a, B: ?Sized> Deref for Cow<'a, B> where B: ToOwned {
impl<'a, B: ?Sized> Eq for Cow<'a, B> where B: Eq + ToOwned {}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> Ord for Cow<'a, B> where B: Ord + ToOwned {
impl<'a, B: ?Sized> Ord for Cow<'a, B>
where B: Ord + ToOwned
{
#[inline]
fn cmp(&self, other: &Cow<'a, B>) -> Ordering {
Ord::cmp(&**self, &**other)
Expand All @@ -215,7 +225,9 @@ impl<'a, 'b, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, C>> for Cow<'a, B>
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> PartialOrd for Cow<'a, B> where B: PartialOrd + ToOwned {
impl<'a, B: ?Sized> PartialOrd for Cow<'a, B>
where B: PartialOrd + ToOwned
{
#[inline]
fn partial_cmp(&self, other: &Cow<'a, B>) -> Option<Ordering> {
PartialOrd::partial_cmp(&**self, &**other)
Expand Down Expand Up @@ -249,7 +261,9 @@ impl<'a, B: ?Sized> fmt::Display for Cow<'a, B>
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
impl<'a, B: ?Sized> Hash for Cow<'a, B>
where B: Hash + ToOwned
{
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
Hash::hash(&**self, state)
Expand Down
Loading