Skip to content

Commit 7baf48f

Browse files
authored
Rollup merge of #78620 - gabhijit:bitops_doc_fix, r=m-ou-se
Trivial fixes to bitwise operator documentation Added fixes to documentation of `BitAnd`, `BitOr`, `BitXor` and `BitAndAssign`, where the documentation for implementation on `Vector<bool>` was using logical operators in place of the bitwise operators. r? @steveklabnik Closes #78619
2 parents 61305d5 + d422e24 commit 7baf48f

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

library/core/src/ops/bit.rs

+23-12
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
109109
/// fn bitand(self, Self(rhs): Self) -> Self::Output {
110110
/// let Self(lhs) = self;
111111
/// assert_eq!(lhs.len(), rhs.len());
112-
/// Self(lhs.iter()
112+
/// Self(
113+
/// lhs.iter()
113114
/// .zip(rhs.iter())
114-
/// .map(|(x, y)| *x && *y)
115-
/// .collect())
115+
/// .map(|(x, y)| *x & *y)
116+
/// .collect()
117+
/// )
116118
/// }
117119
/// }
118120
///
@@ -207,7 +209,12 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
207209
/// fn bitor(self, Self(rhs): Self) -> Self::Output {
208210
/// let Self(lhs) = self;
209211
/// assert_eq!(lhs.len(), rhs.len());
210-
/// Self(lhs.iter().zip(rhs.iter()).map(|(x, y)| *x || *y).collect())
212+
/// Self(
213+
/// lhs.iter()
214+
/// .zip(rhs.iter())
215+
/// .map(|(x, y)| *x | *y)
216+
/// .collect()
217+
/// )
211218
/// }
212219
/// }
213220
///
@@ -302,10 +309,12 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
302309
/// fn bitxor(self, Self(rhs): Self) -> Self::Output {
303310
/// let Self(lhs) = self;
304311
/// assert_eq!(lhs.len(), rhs.len());
305-
/// Self(lhs.iter()
312+
/// Self(
313+
/// lhs.iter()
306314
/// .zip(rhs.iter())
307-
/// .map(|(x, y)| (*x || *y) && !(*x && *y))
308-
/// .collect())
315+
/// .map(|(x, y)| *x ^ *y)
316+
/// .collect()
317+
/// )
309318
/// }
310319
/// }
311320
///
@@ -643,11 +652,13 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
643652
/// // `rhs` is the "right-hand side" of the expression `a &= b`.
644653
/// fn bitand_assign(&mut self, rhs: Self) {
645654
/// assert_eq!(self.0.len(), rhs.0.len());
646-
/// *self = Self(self.0
647-
/// .iter()
648-
/// .zip(rhs.0.iter())
649-
/// .map(|(x, y)| *x && *y)
650-
/// .collect());
655+
/// *self = Self(
656+
/// self.0
657+
/// .iter()
658+
/// .zip(rhs.0.iter())
659+
/// .map(|(x, y)| *x & *y)
660+
/// .collect()
661+
/// );
651662
/// }
652663
/// }
653664
///

0 commit comments

Comments
 (0)