Skip to content

Commit c7d5f7e

Browse files
committed
Rust has type aliases, not typedefs.
They're the same thing but it's better to keep the terminology consistent.
1 parent f2655e2 commit c7d5f7e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libcollections/fmt.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@
165165
//! provides some helper methods.
166166
//!
167167
//! Additionally, the return value of this function is `fmt::Result` which is a
168-
//! typedef to `Result<(), std::fmt::Error>`. Formatting implementations should
169-
//! ensure that they propagate errors from the `Formatter` (e.g., when calling
170-
//! `write!`) however, they should never return errors spuriously. That is, a
171-
//! formatting implementation must and may only return an error if the passed-in
172-
//! `Formatter` returns an error. This is because, contrary to what the function
173-
//! signature might suggest, string formatting is an infallible operation.
174-
//! This function only returns a result because writing to the underlying stream
175-
//! might fail and it must provide a way to propagate the fact that an error has
176-
//! occurred back up the stack.
168+
//! type alias of `Result<(), std::fmt::Error>`. Formatting implementations
169+
//! should ensure that they propagate errors from the `Formatter` (e.g., when
170+
//! calling `write!`) however, they should never return errors spuriously. That
171+
//! is, a formatting implementation must and may only return an error if the
172+
//! passed-in `Formatter` returns an error. This is because, contrary to what
173+
//! the function signature might suggest, string formatting is an infallible
174+
//! operation. This function only returns a result because writing to the
175+
//! underlying stream might fail and it must provide a way to propagate the fact
176+
//! that an error has occurred back up the stack.
177177
//!
178178
//! An example of implementing the formatting traits would look
179179
//! like:

0 commit comments

Comments
 (0)