Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad4fde6

Browse files
Rollup merge ofrust-lang#127363 - GuillaumeGomez:improve-fmt-code-readability, r=Amanieu
Improve readability of some fmt code examplesSome indent was weird. Some examples were too long (overall better to keep it to maximum 80 columns, but only changed the most outstanding ones).r? ```@Amanieu```
2 parents3eeca5f +2fcdebb commitad4fde6

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

‎core/src/fmt/mod.rs‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,10 @@ impl Display for Arguments<'_> {
517517
///
518518
/// let origin = Point { x: 0, y: 0 };
519519
///
520-
/// assert_eq!(format!("The origin is: {origin:?}"), "The origin is: Point { x: 0, y: 0 }");
520+
/// assert_eq!(
521+
/// format!("The origin is: {origin:?}"),
522+
/// "The origin is: Point { x: 0, y: 0 }",
523+
/// );
521524
/// ```
522525
///
523526
/// Manually implementing:
@@ -541,7 +544,10 @@ impl Display for Arguments<'_> {
541544
///
542545
/// let origin = Point { x: 0, y: 0 };
543546
///
544-
/// assert_eq!(format!("The origin is: {origin:?}"), "The origin is: Point { x: 0, y: 0 }");
547+
/// assert_eq!(
548+
/// format!("The origin is: {origin:?}"),
549+
/// "The origin is: Point { x: 0, y: 0 }",
550+
/// );
545551
/// ```
546552
///
547553
/// There are a number of helper methods on the [`Formatter`] struct to help you with manual
@@ -582,11 +588,11 @@ impl Display for Arguments<'_> {
582588
///
583589
/// let origin = Point { x: 0, y: 0 };
584590
///
585-
/// assert_eq!(format!("The origin is: {origin:#?}"),
586-
/// "The origin is: Point {
591+
/// let expected = "The origin is: Point {
587592
/// x: 0,
588593
/// y: 0,
589-
/// }");
594+
/// }";
595+
/// assert_eq!(format!("The origin is: {origin:#?}"), expected);
590596
/// ```
591597
592598
#[stable(feature ="rust1", since ="1.0.0")]
@@ -738,8 +744,10 @@ pub trait Display {
738744
/// }
739745
/// }
740746
///
741-
/// assert_eq!("(1.987, 2.983)",
742-
/// format!("{}", Position { longitude: 1.987, latitude: 2.983, }));
747+
/// assert_eq!(
748+
/// "(1.987, 2.983)",
749+
/// format!("{}", Position { longitude: 1.987, latitude: 2.983, }),
750+
/// );
743751
/// ```
744752
#[stable(feature ="rust1", since ="1.0.0")]
745753
fnfmt(&self,f:&mutFormatter<'_>) ->Result;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp