Skip to content

Commit

Permalink
don't unwrap split
Browse files Browse the repository at this point in the history
  • Loading branch information
Druue committed Jul 3, 2024
1 parent 5d25b91 commit 3b70d69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions prisma-fmt/src/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fn find_where_used_for_native_type<'ast>(
.1
.attributes
.iter()
.find(|attr| extract_ds_from_native_type(attr.name()) == name)
.find(|attr| extract_ds_from_native_type(attr.name()) == Some(name))
.map(|attr| attr.identifier())
}))
}
Expand Down Expand Up @@ -224,8 +224,8 @@ fn find_where_used_as_ds_name<'ast>(ctx: &'ast ReferencesContext<'_>, name: &'as
.map(|source| ctx.db.ast(source.0)[source.1].identifier())
}

fn extract_ds_from_native_type(attr_name: &str) -> &str {
attr_name.split('.').next().unwrap_or("")
fn extract_ds_from_native_type(attr_name: &str) -> Option<&str> {
attr_name.split('.').next()
}

fn ident_to_location<'ast>(id: &'ast Identifier, ctx: &'ast ReferencesContext<'_>) -> Option<Location> {
Expand Down

0 comments on commit 3b70d69

Please # to comment.