mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
R# cleanup
This commit is contained in:
@@ -23,6 +23,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace ArchiSteamFarm.Collections {
|
||||
|
||||
public ConcurrentHashSet() => BackingCollection = new ConcurrentDictionary<T, bool>();
|
||||
|
||||
public ConcurrentHashSet([NotNull] IEqualityComparer<T> comparer) {
|
||||
public ConcurrentHashSet([JetBrains.Annotations.NotNull] IEqualityComparer<T> comparer) {
|
||||
if (comparer == null) {
|
||||
throw new ArgumentNullException(nameof(comparer));
|
||||
}
|
||||
@@ -46,7 +47,7 @@ namespace ArchiSteamFarm.Collections {
|
||||
public bool Add(T item) => BackingCollection.TryAdd(item, true);
|
||||
public void Clear() => BackingCollection.Clear();
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
||||
public bool Contains(T item) => BackingCollection.ContainsKey(item);
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex) => BackingCollection.Keys.CopyTo(array, arrayIndex);
|
||||
@@ -97,7 +98,7 @@ namespace ArchiSteamFarm.Collections {
|
||||
return otherSet.Any(Contains);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
||||
public bool Remove(T item) => BackingCollection.TryRemove(item, out _);
|
||||
|
||||
public bool SetEquals(IEnumerable<T> other) {
|
||||
@@ -126,22 +127,22 @@ namespace ArchiSteamFarm.Collections {
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AnnotationConflictInHierarchy")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
||||
void ICollection<T>.Add([NotNull] T item) => Add(item);
|
||||
[SuppressMessage("ReSharper", "AnnotationConflictInHierarchy")]
|
||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
||||
void ICollection<T>.Add([JetBrains.Annotations.NotNull] T item) => Add(item);
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
|
||||
// We use Count() and not Any() because we must ensure full loop pass
|
||||
[PublicAPI]
|
||||
public bool AddRange([NotNull] IEnumerable<T> items) => items.Count(Add) > 0;
|
||||
public bool AddRange([JetBrains.Annotations.NotNull] IEnumerable<T> items) => items.Count(Add) > 0;
|
||||
|
||||
// We use Count() and not Any() because we must ensure full loop pass
|
||||
[PublicAPI]
|
||||
public bool RemoveRange([NotNull] IEnumerable<T> items) => items.Count(Remove) > 0;
|
||||
public bool RemoveRange([JetBrains.Annotations.NotNull] IEnumerable<T> items) => items.Count(Remove) > 0;
|
||||
|
||||
[PublicAPI]
|
||||
public bool ReplaceIfNeededWith([NotNull] IReadOnlyCollection<T> other) {
|
||||
public bool ReplaceIfNeededWith([JetBrains.Annotations.NotNull] IReadOnlyCollection<T> other) {
|
||||
if (SetEquals(other)) {
|
||||
return false;
|
||||
}
|
||||
@@ -152,7 +153,7 @@ namespace ArchiSteamFarm.Collections {
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public void ReplaceWith([NotNull] IEnumerable<T> other) {
|
||||
public void ReplaceWith([JetBrains.Annotations.NotNull] IEnumerable<T> other) {
|
||||
BackingCollection.Clear();
|
||||
|
||||
foreach (T item in other) {
|
||||
|
||||
Reference in New Issue
Block a user