File tree Expand file tree Collapse file tree 9 files changed +23
-20
lines changed Expand file tree Collapse file tree 9 files changed +23
-20
lines changed Original file line number Diff line number Diff line change
1
+ msrv = " 1.51.0"
Original file line number Diff line number Diff line change 86
86
uses : actions-rs/cargo@v1
87
87
with :
88
88
command : clippy
89
- args : -- -D warnings
90
89
- name : Format check
91
90
uses : actions-rs/cargo@v1
92
91
with :
Original file line number Diff line number Diff line change 18
18
//! * Other kind of prompts
19
19
//! * Editor launching
20
20
21
+ #![ deny( clippy:: all) ]
22
+
21
23
#[ cfg( feature = "completion" ) ]
22
24
pub use completion:: Completion ;
23
25
pub use console;
Original file line number Diff line number Diff line change @@ -59,13 +59,13 @@ impl<'a> Paging<'a> {
59
59
self . pages = ( self . items_len as f64 / self . capacity as f64 ) . ceil ( ) as usize ;
60
60
}
61
61
62
- if self . active != ( self . pages > 1 ) {
62
+ if self . active == ( self . pages > 1 ) {
63
+ self . activity_transition = false ;
64
+ } else {
63
65
self . active = self . pages > 1 ;
64
66
self . activity_transition = true ;
65
67
// Clear everything to prevent "ghost" lines in terminal when a resize happened
66
68
self . term . clear_last_lines ( self . capacity ) ?;
67
- } else {
68
- self . activity_transition = false ;
69
69
}
70
70
71
71
if cursor_pos != !0
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ impl Confirm<'_> {
98
98
///
99
99
/// The dialog is rendered on stderr.
100
100
///
101
- /// Result contains `bool` if user answered "yes" or "no" or `default` (configured in [default](#method. default) ) if pushes enter.
102
- /// This unlike [interact_opt](#method. interact_opt) does not allow to quit with 'Esc' or 'q'.
101
+ /// Result contains `bool` if user answered "yes" or "no" or `default` (configured in [` default`](Self:: default) if pushes enter.
102
+ /// This unlike [` interact_opt`](Self:: interact_opt) does not allow to quit with 'Esc' or 'q'.
103
103
#[ inline]
104
104
pub fn interact ( & self ) -> io:: Result < bool > {
105
105
self . interact_on ( & Term :: stderr ( ) )
@@ -109,7 +109,7 @@ impl Confirm<'_> {
109
109
///
110
110
/// The dialog is rendered on stderr.
111
111
///
112
- /// Result contains `Some(bool)` if user answered "yes" or "no" or `Some(default)` (configured in [default](#method. default)) if pushes enter,
112
+ /// Result contains `Some(bool)` if user answered "yes" or "no" or `Some(default)` (configured in [` default`](Self:: default)) if pushes enter,
113
113
/// or `None` if user cancelled with 'Esc' or 'q'.
114
114
#[ inline]
115
115
pub fn interact_opt ( & self ) -> io:: Result < Option < bool > > {
@@ -137,7 +137,7 @@ impl Confirm<'_> {
137
137
. ok_or_else ( || io:: Error :: new ( io:: ErrorKind :: Other , "Quit not allowed in this case" ) )
138
138
}
139
139
140
- /// Like [interact_opt](#method. interact_opt) but allows a specific terminal to be set.
140
+ /// Like [` interact_opt`](Self:: interact_opt) but allows a specific terminal to be set.
141
141
///
142
142
/// ## Examples
143
143
/// ```rust,no_run
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ impl MultiSelect<'_> {
58
58
self . defaults = val
59
59
. to_vec ( )
60
60
. iter ( )
61
- . cloned ( )
61
+ . copied ( )
62
62
. chain ( repeat ( false ) )
63
63
. take ( self . items . len ( ) )
64
64
. collect ( ) ;
@@ -130,7 +130,7 @@ impl MultiSelect<'_> {
130
130
/// The user can select the items with the 'Space' bar and on 'Enter' the indices of selected items will be returned.
131
131
/// The dialog is rendered on stderr.
132
132
/// Result contains `Vec<index>` if user hit 'Enter'.
133
- /// This unlike [interact_opt](#method. interact_opt) does not allow to quit with 'Esc' or 'q'.
133
+ /// This unlike [` interact_opt`](Self:: interact_opt) does not allow to quit with 'Esc' or 'q'.
134
134
#[ inline]
135
135
pub fn interact ( & self ) -> io:: Result < Vec < usize > > {
136
136
self . interact_on ( & Term :: stderr ( ) )
@@ -170,7 +170,7 @@ impl MultiSelect<'_> {
170
170
. ok_or_else ( || io:: Error :: new ( io:: ErrorKind :: Other , "Quit not allowed in this case" ) )
171
171
}
172
172
173
- /// Like [interact_opt](#method. interact_opt) but allows a specific terminal to be set.
173
+ /// Like [` interact_opt`](Self:: interact_opt) but allows a specific terminal to be set.
174
174
///
175
175
/// ## Examples
176
176
/// ```rust,no_run
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ impl Select<'_> {
167
167
/// The user can select the items with the 'Space' bar or 'Enter' and the index of selected item will be returned.
168
168
/// The dialog is rendered on stderr.
169
169
/// Result contains `index` if user selected one of items using 'Enter'.
170
- /// This unlike [interact_opt](#method. interact_opt) does not allow to quit with 'Esc' or 'q'.
170
+ /// This unlike [` interact_opt`](Self:: interact_opt) does not allow to quit with 'Esc' or 'q'.
171
171
#[ inline]
172
172
pub fn interact ( & self ) -> io:: Result < usize > {
173
173
self . interact_on ( & Term :: stderr ( ) )
@@ -207,7 +207,7 @@ impl Select<'_> {
207
207
. ok_or_else ( || io:: Error :: new ( io:: ErrorKind :: Other , "Quit not allowed in this case" ) )
208
208
}
209
209
210
- /// Like [interact_opt](#method. interact_opt) but allows a specific terminal to be set.
210
+ /// Like [` interact_opt`](Self:: interact_opt) but allows a specific terminal to be set.
211
211
///
212
212
/// ## Examples
213
213
/// ```rust,no_run
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ impl Sort<'_> {
102
102
/// The user can order the items with the 'Space' bar and the arrows. On 'Enter' ordered list of the incides of items will be returned.
103
103
/// The dialog is rendered on stderr.
104
104
/// Result contains `Vec<index>` if user hit 'Enter'.
105
- /// This unlike [interact_opt](#method. interact_opt) does not allow to quit with 'Esc' or 'q'.
105
+ /// This unlike [` interact_opt`](Self:: interact_opt) does not allow to quit with 'Esc' or 'q'.
106
106
#[ inline]
107
107
pub fn interact ( & self ) -> io:: Result < Vec < usize > > {
108
108
self . interact_on ( & Term :: stderr ( ) )
@@ -142,7 +142,7 @@ impl Sort<'_> {
142
142
. ok_or_else ( || io:: Error :: new ( io:: ErrorKind :: Other , "Quit not allowed in this case" ) )
143
143
}
144
144
145
- /// Like [interact_opt](#method. interact_opt) but allows a specific terminal to be set.
145
+ /// Like [` interact_opt`](Self:: interact_opt) but allows a specific terminal to be set.
146
146
///
147
147
/// ## Examples
148
148
/// ```rust,no_run
Original file line number Diff line number Diff line change @@ -506,15 +506,16 @@ impl Theme for ColorfulTheme {
506
506
text : & str ,
507
507
active : bool ,
508
508
) -> fmt:: Result {
509
- let details = match active {
510
- true => (
509
+ let details = if active {
510
+ (
511
511
& self . active_item_prefix ,
512
512
self . active_item_style . apply_to ( text) ,
513
- ) ,
514
- false => (
513
+ )
514
+ } else {
515
+ (
515
516
& self . inactive_item_prefix ,
516
517
self . inactive_item_style . apply_to ( text) ,
517
- ) ,
518
+ )
518
519
} ;
519
520
520
521
write ! ( f, "{} {}" , details. 0 , details. 1 )
You can’t perform that action at this time.
0 commit comments