mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 05:33:41 +00:00
Merge #6483
6483: don\t indent tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
6a759e5160
@ -89,6 +89,32 @@ There are many benefits to this:
|
||||
It also makes sense to format snippets more compactly (for example, by placing enum definitions like `enum E { Foo, Bar }` on a single line),
|
||||
as long as they are still readable.
|
||||
|
||||
When using multiline fixtures, use unindented raw string literals:
|
||||
|
||||
```rust
|
||||
#[test]
|
||||
fn inline_field_shorthand() {
|
||||
check_assist(
|
||||
inline_local_variable,
|
||||
r"
|
||||
struct S { foo: i32}
|
||||
fn main() {
|
||||
let <|>foo = 92;
|
||||
S { foo }
|
||||
}
|
||||
",
|
||||
r"
|
||||
struct S { foo: i32}
|
||||
fn main() {
|
||||
S { foo: 92 }
|
||||
}
|
||||
",
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
That way, you can use your editor's "number of selected characters" feature to correlate offsets with test's source code.
|
||||
|
||||
## Preconditions
|
||||
|
||||
Express function preconditions in types and force the caller to provide them (rather than checking in callee):
|
||||
|
Loading…
Reference in New Issue
Block a user