fix: don't allocate new string when not needed
This commit is contained in:
parent
d975e267b9
commit
5d06fbb46d
1 changed files with 6 additions and 1 deletions
|
|
@ -16,7 +16,12 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata) {
|
|||
|
||||
if let Some(resolve) = &metadata.resolve
|
||||
&& let Some(local_id) = packages.iter().find_map(|p| {
|
||||
if p.name.replace('-', "_") == local_name.as_str() {
|
||||
if p.name
|
||||
.chars()
|
||||
.into_iter()
|
||||
.map(|c| if c == '-' { '_' } else { c })
|
||||
.eq(local_name.as_str().chars())
|
||||
{
|
||||
Some(&p.id)
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue