Skip to content
Merged
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
8 changes: 4 additions & 4 deletions mea/src/mpsc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ impl<T> Clone for BoundedSender<T> {
}

impl<T> fmt::Debug for BoundedSender<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("BoundedSender").finish_non_exhaustive()
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("BoundedSender").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -227,8 +227,8 @@ pub struct BoundedReceiver<T> {
unsafe impl<T: Send> Sync for BoundedReceiver<T> {}

impl<T> fmt::Debug for BoundedReceiver<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("BoundedReceiver").finish_non_exhaustive()
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("BoundedReceiver").finish_non_exhaustive()
}
}

Expand Down
38 changes: 19 additions & 19 deletions mea/src/mpsc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::any::type_name;
use std::fmt;

/// An error returned when trying to send on a closed channel.
Expand Down Expand Up @@ -49,13 +50,13 @@ impl<T> SendError<T> {

impl<T> fmt::Display for SendError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"sending on a closed channel".fmt(f)
f.write_str("sending on a closed channel")
}
}

impl<T> fmt::Debug for SendError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "SendError<{}>(..)", stringify!(T))
write!(f, "SendError<{}>(..)", type_name::<T>())
}
}

Expand Down Expand Up @@ -88,21 +89,20 @@ impl<T> TrySendError<T> {
}

impl<T> fmt::Display for TrySendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
TrySendError::Full(_) => "sending on a full channel".fmt(fmt),
TrySendError::Disconnected(_) => "sending on a closed channel".fmt(fmt),
}
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
TrySendError::Full(_) => "sending on a full channel",
TrySendError::Disconnected(_) => "sending on a closed channel",
})
}
}

impl<T> fmt::Debug for TrySendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let ty = type_name::<T>();
match self {
TrySendError::Full(_) => write!(fmt, "TrySendError<{}>::Full(..)", stringify!(T)),
TrySendError::Disconnected(_) => {
write!(fmt, "TrySendError<{}>::Disconnected(..)", stringify!(T))
}
TrySendError::Full(_) => write!(f, "TrySendError<{ty}>::Full(..)"),
TrySendError::Disconnected(_) => write!(f, "TrySendError<{ty}>::Disconnected(..)"),
}
}
}
Expand All @@ -117,8 +117,8 @@ pub enum RecvError {
}

impl fmt::Display for RecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
"receiving on a closed channel".fmt(fmt)
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("receiving on a closed channel")
}
}

Expand All @@ -135,11 +135,11 @@ pub enum TryRecvError {
}

impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TryRecvError::Empty => "receiving on an empty channel".fmt(fmt),
TryRecvError::Disconnected => "receiving on a closed channel".fmt(fmt),
}
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
TryRecvError::Empty => "receiving on an empty channel",
TryRecvError::Disconnected => "receiving on a closed channel",
})
}
}

Expand Down
9 changes: 4 additions & 5 deletions mea/src/mpsc/unbounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ impl<T> Clone for UnboundedSender<T> {
}

impl<T> fmt::Debug for UnboundedSender<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("UnboundedSender").finish_non_exhaustive()
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UnboundedSender").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -139,9 +139,8 @@ pub struct UnboundedReceiver<T> {
unsafe impl<T: Send> Sync for UnboundedReceiver<T> {}

impl<T> fmt::Debug for UnboundedReceiver<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("UnboundedReceiver")
.finish_non_exhaustive()
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UnboundedReceiver").finish_non_exhaustive()
}
}

Expand Down
Loading