File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change
1
+ /// Use this to infer type for val, as same as type ascription
2
+ pub const fn infer < T > ( val : T ) -> T {
3
+ val
4
+ }
Original file line number Diff line number Diff line change 1
1
pub mod fp;
2
2
pub mod http;
3
+ pub mod infer;
3
4
pub mod iter;
4
5
pub mod json;
5
6
pub mod option;
Original file line number Diff line number Diff line change @@ -14,12 +14,13 @@ use crate::api::user::User;
14
14
use crate :: args:: parser:: no_operation;
15
15
use crate :: args:: { parser, Args } ;
16
16
use crate :: infra:: fp:: currying:: eq;
17
+ use crate :: infra:: infer:: infer;
17
18
use crate :: infra:: iter:: IntoIteratorExt ;
18
19
use crate :: infra:: option:: OptionExt ;
19
20
use crate :: infra:: result:: IntoResult ;
20
21
use anyhow:: Result ;
21
- use clap:: CommandFactory ;
22
22
use clap:: Parser ;
23
+ use clap:: { Command , CommandFactory } ;
23
24
use colored:: Colorize ;
24
25
use std:: env;
25
26
@@ -164,10 +165,8 @@ async fn main() -> Result<()> {
164
165
display:: list_news ( style, time_style, & news_vec, rev) ?
165
166
}
166
167
167
- _ if no_operation ( & args) => {
168
- Args :: command ( ) . print_help ( ) ?;
169
- return ( ) . into_ok ( ) ;
170
- }
168
+ _ if no_operation ( & args) =>
169
+ infer :: < Command > ( Args :: command ( ) ) . render_help ( ) . to_string ( ) ,
171
170
_ => "Invalid usage, follow '--help' for more information" . to_owned ( )
172
171
} ;
173
172
You can’t perform that action at this time.
0 commit comments