@@ -11,15 +11,12 @@ pub enum Arg {
11
11
Expr ( String ) ,
12
12
}
13
13
14
- /**
15
- Add placeholders like `$1` and `$2` in place of [`Arg::Placeholder`],
16
- and unwraps the [`Arg::Ident`] and [`Arg::Expr`] enums.
17
- ```rust
18
- # use ide_db::syntax_helpers::format_string_exprs::*;
19
- assert_eq!(with_placeholders(vec![Arg::Ident("ident".to_owned()), Arg::Placeholder, Arg::Expr("expr + 2".to_owned())]), vec!["ident".to_owned(), "$1".to_owned(), "expr + 2".to_owned()])
20
- ```
21
- */
22
-
14
+ /// Add placeholders like `$1` and `$2` in place of [`Arg::Placeholder`],
15
+ /// and unwraps the [`Arg::Ident`] and [`Arg::Expr`] enums.
16
+ /// ```rust
17
+ /// # use ide_db::syntax_helpers::format_string_exprs::*;
18
+ /// assert_eq!(with_placeholders(vec![Arg::Ident("ident".to_owned()), Arg::Placeholder, Arg::Expr("expr + 2".to_owned())]), vec!["ident".to_owned(), "$1".to_owned(), "expr + 2".to_owned()])
19
+ /// ```
23
20
pub fn with_placeholders ( args : Vec < Arg > ) -> Vec < String > {
24
21
let mut placeholder_id = 1 ;
25
22
args. into_iter ( )
@@ -34,18 +31,15 @@ pub fn with_placeholders(args: Vec<Arg>) -> Vec<String> {
34
31
. collect ( )
35
32
}
36
33
37
- /**
38
- Parser for a format-like string. It is more allowing in terms of string contents,
39
- as we expect variable placeholders to be filled with expressions.
40
-
41
- Built for completions and assists, and escapes `\` and `$` in output.
42
- (See the comments on `get_receiver_text()` for detail.)
43
- Splits a format string that may contain expressions
44
- like
45
- ```rust
46
- assert_eq!(parse("{ident} {} {expr + 42} ").unwrap(), ("{} {} {}", vec![Arg::Ident("ident"), Arg::Placeholder, Arg::Expr("expr + 42")]));
47
- ```
48
- */
34
+ /// Parser for a format-like string. It is more allowing in terms of string contents,
35
+ /// as we expect variable placeholders to be filled with expressions.
36
+ ///
37
+ /// Splits a format string that may contain expressions
38
+ /// like
39
+ /// ```rust
40
+ /// # use ide_db::syntax_helpers::format_string_exprs::*;
41
+ /// assert_eq!(parse_format_exprs("{ident} {} {expr + 42} ").unwrap(), ("{ident} {} {} ".to_owned(), vec![Arg::Placeholder, Arg::Expr("expr + 42".to_owned())]));
42
+ /// ```
49
43
pub fn parse_format_exprs ( input : & str ) -> Result < ( String , Vec < Arg > ) , ( ) > {
50
44
#[ derive( Debug , Clone , Copy , PartialEq ) ]
51
45
enum State {
0 commit comments