Skip to content

Commit 85332e3

Browse files
committed
Combine impl<'a> Arguments<'a> blocks
1 parent c880acd commit 85332e3

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

library/core/src/fmt/mod.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -743,23 +743,6 @@ impl<'a> Arguments<'a> {
743743
}
744744
}
745745

746-
impl<'a> Arguments<'a> {
747-
/// Create a `fmt::Arguments` object for a single static string.
748-
///
749-
/// Formatting this `fmt::Arguments` will just produce the string as-is.
750-
#[inline]
751-
#[unstable(feature = "fmt_arguments_from_str", issue = "148905")]
752-
pub const fn from_str(s: &'static str) -> Arguments<'a> {
753-
// SAFETY: This is the "static str" representation of fmt::Arguments; see above.
754-
unsafe {
755-
Arguments {
756-
template: mem::transmute(s.as_ptr()),
757-
args: mem::transmute(s.len() << 1 | 1),
758-
}
759-
}
760-
}
761-
}
762-
763746
#[doc(hidden)]
764747
#[unstable(feature = "fmt_internals", issue = "none")]
765748
impl<'a> Arguments<'a> {
@@ -824,6 +807,21 @@ impl<'a> Arguments<'a> {
824807
}
825808

826809
impl<'a> Arguments<'a> {
810+
/// Create a `fmt::Arguments` object for a single static string.
811+
///
812+
/// Formatting this `fmt::Arguments` will just produce the string as-is.
813+
#[inline]
814+
#[unstable(feature = "fmt_arguments_from_str", issue = "148905")]
815+
pub const fn from_str(s: &'static str) -> Arguments<'a> {
816+
// SAFETY: This is the "static str" representation of fmt::Arguments; see above.
817+
unsafe {
818+
Arguments {
819+
template: mem::transmute(s.as_ptr()),
820+
args: mem::transmute(s.len() << 1 | 1),
821+
}
822+
}
823+
}
824+
827825
/// Gets the formatted string, if it has no arguments to be formatted at runtime.
828826
///
829827
/// This can be used to avoid allocations in some cases.

0 commit comments

Comments
 (0)