Skip to content

Commit 59e8088

Browse files
committed
clean up reference usages in lexer
to make `cargo expand` print prettier
1 parent d2b8b25 commit 59e8088

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

macros/src/lexer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::iter::Peekable;
1414
pub fn scan_str_lit(lit: &Literal) -> TokenStream {
1515
let s = lit.to_string();
1616
if !s.starts_with('\"') {
17-
return quote!(::cmd_lib::CmdString::from(&#lit));
17+
return quote!(::cmd_lib::CmdString::from(#lit));
1818
}
1919
let mut iter = s[1..s.len() - 1] // To trim outside ""
2020
.chars()
@@ -25,7 +25,7 @@ pub fn scan_str_lit(lit: &Literal) -> TokenStream {
2525
if !last_part.is_empty() {
2626
let lit_str = format!("\"{}\"", last_part.to_str().unwrap());
2727
let l = syn::parse_str::<Literal>(&lit_str).unwrap();
28-
output.extend(quote!(.append(&#l)));
28+
output.extend(quote!(.append(#l)));
2929
last_part.clear();
3030
}
3131
}
@@ -66,7 +66,7 @@ pub fn scan_str_lit(lit: &Literal) -> TokenStream {
6666
let var = syn::parse_str::<Ident>(&var).unwrap();
6767
output.extend(quote!(.append(#var.as_os_str())));
6868
} else {
69-
output.extend(quote!(.append(&"$")));
69+
output.extend(quote!(.append("$")));
7070
}
7171
} else {
7272
last_part.push(ch.to_string());
@@ -124,7 +124,7 @@ impl Lexer {
124124
}
125125
TokenTree::Ident(ident) => {
126126
let s = ident.to_string();
127-
self.extend_last_arg(quote!(&#s));
127+
self.extend_last_arg(quote!(#s));
128128
}
129129
TokenTree::Punct(punct) => {
130130
let ch = punct.as_char();
@@ -143,7 +143,7 @@ impl Lexer {
143143
self.scan_dollar();
144144
} else {
145145
let s = ch.to_string();
146-
self.extend_last_arg(quote!(&#s));
146+
self.extend_last_arg(quote!(#s));
147147
}
148148
}
149149
}
@@ -238,7 +238,7 @@ impl Lexer {
238238
if s.starts_with('\"') || s.starts_with('r') {
239239
// string literal
240240
let ss = scan_str_lit(&lit);
241-
self.extend_last_arg(quote!(&#ss.into_os_string()));
241+
self.extend_last_arg(quote!(#ss.into_os_string()));
242242
} else {
243243
let mut is_redirect = false;
244244
if s == "1" || s == "2" {
@@ -251,7 +251,7 @@ impl Lexer {
251251
}
252252
}
253253
if !is_redirect {
254-
self.extend_last_arg(quote!(&#s));
254+
self.extend_last_arg(quote!(#s));
255255
}
256256
}
257257
}

0 commit comments

Comments
 (0)