mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-24 21:53:21 +00:00
chore(editorconfig): set and apply some defaults (#974)
This commit is contained in:
parent
3834374652
commit
38c17e091c
13 changed files with 40 additions and 35 deletions
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[*.rs]
|
[*.rs]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
1
.github/workflows/check-pr.yml
vendored
1
.github/workflows/check-pr.yml
vendored
|
@ -84,4 +84,3 @@ jobs:
|
||||||
echo "Pull request is labeled as 'do not merge'"
|
echo "Pull request is labeled as 'do not merge'"
|
||||||
echo "This workflow fails so that the pull request cannot be merged"
|
echo "This workflow fails so that the pull request cannot be merged"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ exist to show coverage directly in your editor. E.g.:
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
Here are some guidelines for writing documentation in Ratatui.
|
Here are some guidelines for writing documentation in Ratatui.
|
||||||
|
|
||||||
Every public API **must** be documented.
|
Every public API **must** be documented.
|
||||||
|
|
||||||
Keep in mind that Ratatui tends to attract beginner Rust users that may not be familiar with Rust
|
Keep in mind that Ratatui tends to attract beginner Rust users that may not be familiar with Rust
|
||||||
|
@ -125,10 +126,9 @@ the concepts pointing to the various methods. Focus on interaction with various
|
||||||
enough information that helps understand why you might want something.
|
enough information that helps understand why you might want something.
|
||||||
|
|
||||||
Examples should help users understand a particular usage, not test a feature. They should be as
|
Examples should help users understand a particular usage, not test a feature. They should be as
|
||||||
simple as possible.
|
simple as possible. Prefer hiding imports and using wildcards to keep things concise. Some imports
|
||||||
Prefer hiding imports and using wildcards to keep things concise. Some imports may still be shown
|
may still be shown to demonstrate a particular non-obvious import (e.g. `Stylize` trait to use style
|
||||||
to demonstrate a particular non-obvious import (e.g. `Stylize` trait to use style methods).
|
methods). Speaking of `Stylize`, you should use it over the more verbose style setters:
|
||||||
Speaking of `Stylize`, you should use it over the more verbose style setters:
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let style = Style::new().red().bold();
|
let style = Style::new().red().bold();
|
||||||
|
|
|
@ -189,7 +189,7 @@ impl<'a> BarChart<'a> {
|
||||||
/// If not set, this defaults to `1`.
|
/// If not set, this defaults to `1`.
|
||||||
/// The bar label also uses this value as its width.
|
/// The bar label also uses this value as its width.
|
||||||
#[must_use = "method moves the value of self and returns the modified value"]
|
#[must_use = "method moves the value of self and returns the modified value"]
|
||||||
pub fn bar_width(mut self, width: u16) -> BarChart<'a> {
|
pub const fn bar_width(mut self, width: u16) -> BarChart<'a> {
|
||||||
self.bar_width = width;
|
self.bar_width = width;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue