anchor.diff:          _unusedImports.isEmpty && _unusedShownNamesMap.isEmpty;
   
       // Process import prefixes.
  -    usedElements.prefixMap
  -        .forEach((PrefixElement prefix, List<Element> elements) {
  +    for (var entry in usedElements.prefixMap.entries) {
         if (everythingIsKnownToBeUsed()) {
           return;
         }
  +      var prefix = entry.key;
  +      var importDirectives = _prefixElementMap[prefix];
  +      if (importDirectives == null) {
  +        continue;
  +      }
  +      var elements = entry.value;
         // Find import directives using namespaces.
  -      for (var importDirective
  -          in _prefixElementMap[prefix] ?? <ImportDirective>[]) {
  -        var namespace = _computeNamespace(importDirective);
  +      for (var importDirective in importDirectives) {
           if (elements.isEmpty) {
             // [prefix] and [elements] were added to [usedElements.prefixMap] but
             // [elements] is empty, so the prefix was referenced incorrectly.
  
positive.code:       // Find import directives using namespaces.
        for (ImportDirective importDirective in _allImports) {
          var namespace = _computeNamespace(importDirective);
          var prefix = importDirective.prefix?.name;
          var elementName = extensionElement.name!;
          if (prefix == null) {
            if (namespace?.get(elementName) == extensionElement) {
              _unusedImports.remove(importDirective);
              _removeFromUnusedShownNamesMap(extensionElement, importDirective);
            }
  
negative.code:           // shouldn't confuse by also reporting an unused prefix.
            _unusedImports.remove(importDirective);
          }
          var namespace = _computeNamespace(importDirective);
          if (namespace == null) {
            continue;
          }
          for (var element in elements) {
            if (namespace.getPrefixed(prefix.name, element.name!) != null) {
              _unusedImports.remove(importDirective);
              _removeFromUnusedShownNamesMap(element, importDirective);
            }
          }
        }
      }
  
      // Process top-level elements.
      for (Element element in usedElements.elements) {
        if (everythingIsKnownToBeUsed()) {
  