Skip to content

Commit 66d68cd

Browse files
committed
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 cc #78619
1 parent 4f7612a commit 66d68cd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

library/core/src/ops/bit.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
111111
/// assert_eq!(lhs.len(), rhs.len());
112112
/// Self(lhs.iter()
113113
/// .zip(rhs.iter())
114-
/// .map(|(x, y)| *x && *y)
114+
/// .map(|(x, y)| *x & *y)
115115
/// .collect())
116116
/// }
117117
/// }
@@ -207,7 +207,10 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
207207
/// fn bitor(self, Self(rhs): Self) -> Self::Output {
208208
/// let Self(lhs) = self;
209209
/// assert_eq!(lhs.len(), rhs.len());
210-
/// Self(lhs.iter().zip(rhs.iter()).map(|(x, y)| *x || *y).collect())
210+
/// Self(lhs.iter()
211+
/// .zip(rhs.iter())
212+
/// .map(|(x, y)| *x | *y)
213+
/// .collect())
211214
/// }
212215
/// }
213216
///
@@ -304,7 +307,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
304307
/// assert_eq!(lhs.len(), rhs.len());
305308
/// Self(lhs.iter()
306309
/// .zip(rhs.iter())
307-
/// .map(|(x, y)| (*x || *y) && !(*x && *y))
310+
/// .map(|(x, y)| *x ^ *y))
308311
/// .collect())
309312
/// }
310313
/// }
@@ -646,7 +649,7 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
646649
/// *self = Self(self.0
647650
/// .iter()
648651
/// .zip(rhs.0.iter())
649-
/// .map(|(x, y)| *x && *y)
652+
/// .map(|(x, y)| *x & *y)
650653
/// .collect());
651654
/// }
652655
/// }

0 commit comments

Comments
 (0)