Skip to content

Commit a612ae8

Browse files
committed
refactor(all): enable unnecessary_unwrap lint
1 parent 128b527 commit a612ae8

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ unused_peekable = "warn"
9696
too_long_first_doc_paragraph = "warn"
9797
suspicious_operation_groupings = "warn"
9898
redundant_clone = "warn"
99-
unnecessary_unwrap = "allow" # FIXME
10099
needless_doctest_main = "allow" # FIXME
101100
zero_sized_map_values = "allow" # FIXME https://github.com/rust-lang/rust-clippy/issues/15429
102101
# cargo

crates/oxc_linter/src/rules/nextjs/no_duplicate_head.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,14 @@ impl Rule for NoDuplicateHead {
110110
}
111111

112112
let node_id = reference.node_id();
113-
if first_node_id.is_none() {
114-
// First `<Head>` found
115-
first_node_id = Some(node_id);
116-
} else if labels.is_empty() {
113+
if labels.is_empty()
114+
&& let Some(first_node_id) = first_node_id
115+
{
117116
// 2nd `<Head>` found - populate `labels` with both
118-
let first_node_id = first_node_id.unwrap();
119117
labels.extend([get_label(first_node_id), get_label(node_id)]);
118+
} else if first_node_id.is_none() {
119+
// First `<Head>` found
120+
first_node_id = Some(node_id);
120121
} else {
121122
// Further `<Head>` found - add to `node_ids`
122123
labels.push(get_label(node_id));

crates/oxc_parser/src/js/module.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ impl<'a> ParserImpl<'a> {
8181
let mut phase = None;
8282
let mut import_kind = ImportOrExportKind::Value;
8383

84-
if self.at(Kind::Eq) && identifier_after_import.is_some() {
84+
if self.at(Kind::Eq)
85+
&& let Some(identifier_after_import) = identifier_after_import
86+
{
8587
// `import something = ...`
8688
let decl = self.parse_ts_import_equals_declaration(
8789
ImportOrExportKind::Value,
88-
identifier_after_import.unwrap(),
90+
identifier_after_import,
8991
span,
9092
);
9193
return Statement::from(decl);

0 commit comments

Comments
 (0)