mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: keep empty curlies and parenthesis as they are (#7329)
This commit is contained in:
33
doc/docs.md
33
doc/docs.md
@@ -1509,8 +1509,7 @@ fn main() {
|
||||
## References
|
||||
|
||||
```v
|
||||
struct Foo {
|
||||
}
|
||||
struct Foo {}
|
||||
|
||||
fn (foo Foo) bar_method() {
|
||||
// ...
|
||||
@@ -1730,8 +1729,7 @@ struct Dog {
|
||||
breed string
|
||||
}
|
||||
|
||||
struct Cat {
|
||||
}
|
||||
struct Cat {}
|
||||
|
||||
fn (d Dog) speak() string {
|
||||
return 'woof'
|
||||
@@ -1800,14 +1798,11 @@ A sum type instance can hold a value of several different types. Use the `type`
|
||||
keyword to declare a sum type:
|
||||
|
||||
```v
|
||||
struct Moon {
|
||||
}
|
||||
struct Moon {}
|
||||
|
||||
struct Mars {
|
||||
}
|
||||
struct Mars {}
|
||||
|
||||
struct Venus {
|
||||
}
|
||||
struct Venus {}
|
||||
|
||||
type World = Mars | Moon | Venus
|
||||
|
||||
@@ -1824,14 +1819,11 @@ To check whether a sum type instance holds a certain type, use `sum is Type`.
|
||||
To cast a sum type to one of its variants you can use `sum as Type`:
|
||||
|
||||
```v
|
||||
struct Moon {
|
||||
}
|
||||
struct Moon {}
|
||||
|
||||
struct Mars {
|
||||
}
|
||||
struct Mars {}
|
||||
|
||||
struct Venus {
|
||||
}
|
||||
struct Venus {}
|
||||
|
||||
type World = Mars | Moon | Venus
|
||||
|
||||
@@ -1883,14 +1875,11 @@ complex expression than just a variable name.
|
||||
You can also use `match` to determine the variant:
|
||||
|
||||
```v
|
||||
struct Moon {
|
||||
}
|
||||
struct Moon {}
|
||||
|
||||
struct Mars {
|
||||
}
|
||||
struct Mars {}
|
||||
|
||||
struct Venus {
|
||||
}
|
||||
struct Venus {}
|
||||
|
||||
type World = Mars | Moon | Venus
|
||||
|
||||
|
Reference in New Issue
Block a user