Skip to content

Commit 7a5db09

Browse files
committed
style: format doc comments
1 parent a3e02c4 commit 7a5db09

File tree

9 files changed

+34
-16
lines changed

9 files changed

+34
-16
lines changed

rustfmt.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
wrap_comments = true
22
comment_width = 100
3+
format_code_in_doc_comments = true
34
group_imports = "StdExternalCrate"
45
imports_granularity = "Crate"
56
max_width = 100

tui-big-text/src/big_text.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::PixelSize;
3434
/// "World".blue().into(),
3535
/// "=====".into(),
3636
/// ])
37-
/// .build();
37+
/// .build();
3838
/// ```
3939
///
4040
/// Renders:

tui-cards/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A simple library to render playing cards in a terminal using tui-rs.
1010
use tui_cards::{Card, Rank, Suit};
1111

1212
let card = Card::new(Rank::Ace, Suit::Spades);
13-
frame.render_widget(&card, area);
13+
frame.render_widget(&card, frame.area());
1414
```
1515

1616
## Demo

tui-popup/README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ The popup widget is a simple widget that renders a popup in the center of the sc
1616
## Example
1717

1818
```rust
19-
use ratatui::prelude::*;
19+
use ratatui::{
20+
style::{Style, Stylize},
21+
Frame,
22+
};
2023
use tui_popup::Popup;
2124

2225
fn render_popup(frame: &mut Frame) {
23-
let popup = Popup::new("tui-popup demo", "Press any key to exit")
24-
.style(Style::new().white().on_blue());
25-
frame.render_widget(&popup, frame.size());
26+
let popup = Popup::new("Press any key to exit")
27+
.title("tui-popup demo")
28+
.style(Style::new().white().on_blue());
29+
frame.render_widget(&popup, frame.area());
2630
}
2731
```
2832

2933
![demo](https://vhs.charm.sh/vhs-q5Kz0QP3zmrBlQ6dofjMh.gif)
3034

35+
## Feature flags
36+
3137
<!-- cargo-rdme end -->
3238

3339
## State

tui-popup/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
//! # Example
66
//!
77
//! ```rust
8-
//! use ratatui::{Frame, style::{Style, Stylize}};
8+
//! use ratatui::{
9+
//! style::{Style, Stylize},
10+
//! Frame,
11+
//! };
912
//! use tui_popup::Popup;
1013
//!
1114
//! fn render_popup(frame: &mut Frame) {

tui-qrcode/src/lib.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,11 @@ use ratatui::{
120120
///
121121
/// ```no_run
122122
/// use qrcode::QrCode;
123+
/// use ratatui::{
124+
/// style::{Style, Stylize},
125+
/// Frame,
126+
/// };
123127
/// use tui_qrcode::{Colors, QrCodeWidget, QuietZone, Scaling};
124-
/// use ratatui::{Frame, style::{Style, Stylize}};
125128
///
126129
/// fn render(frame: &mut Frame) {
127130
/// let qr_code = QrCode::new("https://ratatui.rs").expect("failed to create QR code");
@@ -259,7 +262,7 @@ impl QrCodeWidget {
259262
///
260263
/// ```
261264
/// use qrcode::QrCode;
262-
/// use tui_qrcode::{QrCodeWidget, Colors};
265+
/// use tui_qrcode::{Colors, QrCodeWidget};
263266
///
264267
/// let qr_code = QrCode::new("https://ratatui.rs").expect("failed to create QR code");
265268
/// let widget = QrCodeWidget::new(qr_code).colors(Colors::Inverted);
@@ -278,8 +281,8 @@ impl QrCodeWidget {
278281
///
279282
/// ```
280283
/// use qrcode::QrCode;
281-
/// use tui_qrcode::QrCodeWidget;
282284
/// use ratatui::style::{Style, Stylize};
285+
/// use tui_qrcode::QrCodeWidget;
283286
///
284287
/// let qr_code = QrCode::new("https://ratatui.rs").expect("failed to create QR code");
285288
/// let style = Style::new().red().on_light_yellow();

tui-scrollview/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ cargo add tui-scrollview
1818

1919
```rust
2020
use std::iter;
21-
use tui_scrollview::{ScrollView, ScrollViewState};
21+
2222
use ratatui::{layout::Size, prelude::*, widgets::*};
23+
use tui_scrollview::{ScrollView, ScrollViewState};
2324

2425
struct MyScrollableWidget;
2526

@@ -49,7 +50,7 @@ impl StatefulWidget for MyScrollableWidget {
4950
## Full Example
5051

5152
A full example can be found in the [examples] directory.
52-
[scrollview.rs](https://github.com/joshka/tui-widgets/blob/main/tui-scrollview/examples/scrollview.rs)
53+
[scrollview.rs](https://github.com/joshka/tui-widgets/tree/main/tui-scrollview/examples/scrollview.rs)
5354

5455
This example shows a scrollable view with two paragraphs of text, one for the line numbers and
5556
one for the text. On top of this a Gauge widget is rendered to show that this can be used in

tui-scrollview/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
//!
1717
//! ```rust
1818
//! use std::iter;
19-
//! use tui_scrollview::{ScrollView, ScrollViewState};
19+
//!
2020
//! use ratatui::{layout::Size, prelude::*, widgets::*};
21+
//! use tui_scrollview::{ScrollView, ScrollViewState};
2122
//!
2223
//! struct MyScrollableWidget;
2324
//!

tui-scrollview/src/scroll_view.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ impl ScrollView {
127127
/// # use ratatui::{prelude::*, layout::Size, widgets::*};
128128
/// # use tui_scrollview::{ScrollView, ScrollbarVisibility};
129129
///
130-
/// let mut scroll_view = ScrollView::new(Size::new(20, 20)).vertical_scrollbar_visibility(ScrollbarVisibility::Always);
130+
/// let mut scroll_view = ScrollView::new(Size::new(20, 20))
131+
/// .vertical_scrollbar_visibility(ScrollbarVisibility::Always);
131132
/// ```
132133
pub fn vertical_scrollbar_visibility(mut self, visibility: ScrollbarVisibility) -> Self {
133134
self.vertical_scrollbar_visibility = visibility;
@@ -146,7 +147,8 @@ impl ScrollView {
146147
/// # use ratatui::{prelude::*, layout::Size, widgets::*};
147148
/// # use tui_scrollview::{ScrollView, ScrollbarVisibility};
148149
///
149-
/// let mut scroll_view = ScrollView::new(Size::new(20, 20)).horizontal_scrollbar_visibility(ScrollbarVisibility::Never);
150+
/// let mut scroll_view = ScrollView::new(Size::new(20, 20))
151+
/// .horizontal_scrollbar_visibility(ScrollbarVisibility::Never);
150152
/// ```
151153
pub fn horizontal_scrollbar_visibility(mut self, visibility: ScrollbarVisibility) -> Self {
152154
self.horizontal_scrollbar_visibility = visibility;
@@ -165,7 +167,8 @@ impl ScrollView {
165167
/// # use ratatui::{prelude::*, layout::Size, widgets::*};
166168
/// # use tui_scrollview::{ScrollView, ScrollbarVisibility};
167169
///
168-
/// let mut scroll_view = ScrollView::new(Size::new(20, 20)).scrollbars_visibility(ScrollbarVisibility::Automatic);
170+
/// let mut scroll_view =
171+
/// ScrollView::new(Size::new(20, 20)).scrollbars_visibility(ScrollbarVisibility::Automatic);
169172
/// ```
170173
pub fn scrollbars_visibility(mut self, visibility: ScrollbarVisibility) -> Self {
171174
self.vertical_scrollbar_visibility = visibility;

0 commit comments

Comments
 (0)