Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/hir/format_args.rs')
-rw-r--r--crates/hir-def/src/hir/format_args.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir-def/src/hir/format_args.rs b/crates/hir-def/src/hir/format_args.rs
index 113f9441a0..b097a721c7 100644
--- a/crates/hir-def/src/hir/format_args.rs
+++ b/crates/hir-def/src/hir/format_args.rs
@@ -166,6 +166,7 @@ enum PositionUsedAs {
}
use PositionUsedAs::*;
+#[allow(clippy::unnecessary_lazy_evaluations)]
pub(crate) fn parse(
s: &ast::String,
fmt_snippet: Option<String>,
@@ -177,9 +178,9 @@ pub(crate) fn parse(
let text = s.text_without_quotes();
let str_style = match s.quote_offsets() {
Some(offsets) => {
- let raw = u32::from(offsets.quotes.0.len()) - 1;
+ let raw = usize::from(offsets.quotes.0.len()) - 1;
// subtract 1 for the `r` prefix
- (raw != 0).then(|| raw as usize - 1)
+ (raw != 0).then(|| raw - 1)
}
None => None,
};
@@ -432,7 +433,7 @@ pub(crate) fn parse(
}
}
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct FormatArgumentsCollector {
arguments: Vec<FormatArgument>,
num_unnamed_args: usize,
@@ -451,7 +452,7 @@ impl FormatArgumentsCollector {
}
pub fn new() -> Self {
- Self { arguments: vec![], names: vec![], num_unnamed_args: 0, num_explicit_args: 0 }
+ Default::default()
}
pub fn add(&mut self, arg: FormatArgument) -> usize {