Skip to content

Commit a270f5c

Browse files
committed
Fix clippy lint
#[clippy(warn::or_fun_call)]
1 parent 015690d commit a270f5c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

macros/src/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'a> Symbol<'a> {
3131
pub fn new(tag: &'a str, data: &'a str) -> Self {
3232
Self {
3333
// `CARGO_PKG_NAME` is set to the invoking package's name.
34-
package: env::var("CARGO_PKG_NAME").unwrap_or("<unknown>".to_string()),
34+
package: env::var("CARGO_PKG_NAME").unwrap_or_else(|_| "<unknown>".to_string()),
3535
disambiguator: {
3636
// We want a deterministic, but unique-per-macro-invocation identifier. For that we
3737
// hash the call site `Span`'s debug representation, which contains a counter that

parser/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn parse_param(mut input: &str, mode: ParserMode) -> Result<Param, Cow<'static,
169169

170170
// First, optional argument index.
171171
let mut index = None;
172-
let index_end = input.find(|c: char| !c.is_digit(10)).unwrap_or(input.len());
172+
let index_end = input.find(|c: char| !c.is_digit(10)).unwrap_or_else(|| input.len());
173173

174174
if index_end != 0 {
175175
index = Some(
@@ -188,7 +188,7 @@ fn parse_param(mut input: &str, mode: ParserMode) -> Result<Param, Cow<'static,
188188
input = &input[TYPE_PREFIX.len()..];
189189

190190
// type is delimited by `HINT_PREFIX` or end-of-string
191-
let type_end = input.find(HINT_PREFIX).unwrap_or(input.len());
191+
let type_end = input.find(HINT_PREFIX).unwrap_or_else(|| input.len());
192192
let type_fragment = &input[..type_end];
193193

194194
static FORMAT_ARRAY_START: &str = "[?;";

0 commit comments

Comments
 (0)