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 11pub mod fp;
22pub mod http;
3+ pub mod infer;
34pub mod iter;
45pub mod json;
56pub mod option;
Original file line number Diff line number Diff line change @@ -14,12 +14,13 @@ use crate::api::user::User;
1414use crate :: args:: parser:: no_operation;
1515use crate :: args:: { parser, Args } ;
1616use crate :: infra:: fp:: currying:: eq;
17+ use crate :: infra:: infer:: infer;
1718use crate :: infra:: iter:: IntoIteratorExt ;
1819use crate :: infra:: option:: OptionExt ;
1920use crate :: infra:: result:: IntoResult ;
2021use anyhow:: Result ;
21- use clap:: CommandFactory ;
2222use clap:: Parser ;
23+ use clap:: { Command , CommandFactory } ;
2324use colored:: Colorize ;
2425use std:: env;
2526
@@ -164,10 +165,8 @@ async fn main() -> Result<()> {
164165 display:: list_news ( style, time_style, & news_vec, rev) ?
165166 }
166167
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 ( ) ,
171170 _ => "Invalid usage, follow '--help' for more information" . to_owned ( )
172171 } ;
173172
You can’t perform that action at this time.
0 commit comments