Spot the bug in the generic search

from Generics
C# 14 / .NET 10 intermediate 4 min 2 issues to find

Find the two generic correctness problems in this search helper.

csharp
using System.Collections.Generic;

static T Find<T>(IEnumerable<T> items, T target)
{
    foreach (T item in items)
    {
        if (item!.Equals(target))
            return item;
    }
    return default!;
}
Open in playground
Report an error