-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lukas
committed
Jul 5, 2024
1 parent
51917ba
commit 0b31188
Showing
13 changed files
with
83 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,5 @@ pub fn main() { | |
} | ||
|
||
let f = Foo { foo: 10 }; | ||
format!("{:?}", f); | ||
let _ = format!("{:?}", f); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,79 @@ | ||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:11:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:11:23 | ||
| | ||
LL | format!("{foo.field}"); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field}"); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{0}", foo.field); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{0}", foo.field); | ||
| ~ +++++++++++ | ||
|
||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:12:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:12:23 | ||
| | ||
LL | format!("{foo.field} {} {bar}", "aa"); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field} {} {bar}", "aa"); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{1} {} {bar}", "aa", foo.field); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{1} {} {bar}", "aa", foo.field); | ||
| ~ +++++++++++ | ||
|
||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:13:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:13:23 | ||
| | ||
LL | format!("{foo.field} {} {1} {bar}", "aa", "bb"); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb"); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{2} {} {1} {bar}", "aa", "bb", foo.field); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field); | ||
| ~ +++++++++++ | ||
|
||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:14:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:14:23 | ||
| | ||
LL | format!("{foo.field} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{1} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
|
||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:15:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:15:23 | ||
| | ||
LL | format!("{foo.field:?} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{1:?} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
|
||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:16:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:16:23 | ||
| | ||
LL | format!("{foo.field:#?} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
|
||
error: invalid format string: field access isn't supported | ||
--> $DIR/struct-field-as-captured-argument.rs:17:15 | ||
--> $DIR/struct-field-as-captured-argument.rs:17:23 | ||
| | ||
LL | format!("{foo.field:.3} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
LL | let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3); | ||
| ^^^^^^^^^ not supported in format string | ||
| | ||
help: consider using a positional formatting argument instead | ||
| | ||
LL | format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
LL | let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3); | ||
| ~ +++++++++++ | ||
|
||
error: aborting due to 7 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ use std::fmt; | |
|
||
fn main() { | ||
let a: &dyn fmt::Debug = &1; | ||
format!("{:?}", a); | ||
let _ = format!("{:?}", a); | ||
} |