Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused private parameters in SPC #63015

Merged
merged 9 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ dotnet_diagnostic.CA5383.severity = none
# CA5384: Do Not Use Digital Signature Algorithm (DSA)
dotnet_diagnostic.CA5384.severity = warning

# CA5385: Use RivestShamirAdleman (RSA) Algorithm With Sufficient Key Size
# CA5385: Use Rivest-Shamir-Adleman (RSA) Algorithm With Sufficient Key Size
dotnet_diagnostic.CA5385.severity = warning

# CA5386: Avoid hardcoding SecurityProtocolType value
Expand Down Expand Up @@ -1448,6 +1448,7 @@ dotnet_diagnostic.IDE0059.severity = suggestion

# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = silent
dotnet_code_quality_unused_parameters = non_public

# IDE0061: Use expression body for local functions
dotnet_diagnostic.IDE0061.severity = silent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,22 @@ public static class ComActivator
/// <summary>
/// Internal entry point for unmanaged COM activation API from native code
/// </summary>
/// <param name="pCxtInt">Pointer to a <see cref="ComActivationContextInternal"/> instance</param>
[UnmanagedCallersOnly]
private static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInternal* pCxtInt)
private static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInternal* _)
=> throw new PlatformNotSupportedException();

/// <summary>
/// Internal entry point for registering a managed COM server API from native code
/// </summary>
/// <param name="pCxtInt">Pointer to a <see cref="ComActivationContextInternal"/> instance</param>
[UnmanagedCallersOnly]
private static unsafe int RegisterClassForTypeInternal(ComActivationContextInternal* pCxtInt)
private static unsafe int RegisterClassForTypeInternal(ComActivationContextInternal* _)
=> throw new PlatformNotSupportedException();

/// <summary>
/// Internal entry point for unregistering a managed COM server API from native code
/// </summary>
/// <param name="pCxtInt">Pointer to a <see cref="ComActivationContextInternal"/> instance</param>
[UnmanagedCallersOnly]
private static unsafe int UnregisterClassForTypeInternal(ComActivationContextInternal* pCxtInt)
private static unsafe int UnregisterClassForTypeInternal(ComActivationContextInternal* _)
=> throw new PlatformNotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ internal void set_Item<T>(int index, T value)
_this[index] = value;
}

private void Add<T>(T value)
private void Add<T>(T _)
{
// Not meaningful for arrays.
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
Expand Down Expand Up @@ -556,20 +556,20 @@ private int IndexOf<T>(T value)
return Array.IndexOf(_this, value, 0, _this.Length);
}

private void Insert<T>(int index, T value)
private void Insert<T>(int _, T _1)
adamsitnik marked this conversation as resolved.
Show resolved Hide resolved
{
// Not meaningful for arrays
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
}

private bool Remove<T>(T value)
private bool Remove<T>(T _)
{
// Not meaningful for arrays
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
return default;
}

private void RemoveAt<T>(int index)
private void RemoveAt<T>(int _)
{
// Not meaningful for arrays
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo)
}
}

#pragma warning disable IDE0060
private static bool AppendStackFrameWithoutMethodBase(StringBuilder sb) => false;
#pragma warning restore IDE0060

[GeneratedDllImport(RuntimeHelpers.QCall, EntryPoint = "StackFrame_GetMethodDescFromNativeIP")]
private static partial RuntimeMethodHandleInternal GetMethodDescFromNativeIP(IntPtr ip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ protected override MethodInfo GetMethodImpl()
private static void ThrowNullThisInDelegateToInstance() =>
throw new ArgumentException(SR.Arg_DlgtNullInst);

#pragma warning disable IDE0060
[System.Diagnostics.DebuggerNonUserCode]
private void CtorClosed(object target, IntPtr methodPtr)
{
Expand Down Expand Up @@ -635,5 +636,6 @@ private void CtorCollectibleVirtualDispatch(object target, IntPtr methodPtr, Int
this._methodPtrAux = GetCallStub(methodPtr);
this._methodBase = System.Runtime.InteropServices.GCHandle.InternalGet(gchandle);
}
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public sealed class PropertyBuilder : PropertyInfo
internal PropertyBuilder(
ModuleBuilder mod, // the module containing this PropertyBuilder
string name, // property name
SignatureHelper sig, // property signature descriptor info
PropertyAttributes attr, // property attribute such as DefaultProperty, Bindable, DisplayBind, etc
Type returnType, // return type of the property.
int prToken, // the metadata token for this property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,6 @@ private PropertyBuilder DefinePropertyNoLock(string name, PropertyAttributes att
return new PropertyBuilder(
m_module,
name,
sigHelper,
attributes,
returnType,
prToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2804,7 +2804,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn
}

if ((bindingAttr & BindingFlags.ExactBinding) != 0)
return System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo;
return System.DefaultBinder.ExactBinding(candidates.ToArray(), types) as ConstructorInfo;

binder ??= DefaultBinder;
return binder.SelectMethod(bindingAttr, candidates.ToArray(), types, modifiers) as ConstructorInfo;
Expand Down Expand Up @@ -2842,7 +2842,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn
}

if ((bindingAttr & BindingFlags.ExactBinding) != 0)
return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types, modifiers);
return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types);

binder ??= DefaultBinder;
return binder.SelectProperty(bindingAttr, candidates.ToArray(), returnType, types, modifiers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected sealed override ConstructorInfo GetConstructorImpl(BindingFlags bindin
}

if ((bindingAttr & BindingFlags.ExactBinding) != 0)
return System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo;
return System.DefaultBinder.ExactBinding(candidates.ToArray(), types) as ConstructorInfo;

if (binder == null)
binder = DefaultBinder;
Expand Down Expand Up @@ -173,7 +173,7 @@ protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags
}

if ((bindingAttr & BindingFlags.ExactBinding) != 0)
return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types, modifiers);
return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types);

if (binder == null)
binder = DefaultBinder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ internal static SafeFileHandle OpenReadOnly(string fullPath, FileOptions options
}

internal static SafeFileHandle Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize,
Interop.Sys.Permissions openPermissions = DefaultOpenPermissions,
Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null)
Interop.Sys.Permissions openPermissions = DefaultOpenPermissions)
marek-safar marked this conversation as resolved.
Show resolved Hide resolved
marek-safar marked this conversation as resolved.
Show resolved Hide resolved
{
long fileLength;
Interop.Sys.Permissions filePermissions;
Expand Down Expand Up @@ -311,7 +310,7 @@ private bool Init(string path, FileMode mode, FileAccess access, FileShare share
if ((access & FileAccess.Write) == 0)
{
// Stat the file descriptor to avoid race conditions.
FStatCheckIO(this, path, ref status, ref statusHasValue);
FStatCheckIO(path, ref status, ref statusHasValue);

if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR)
{
Expand Down Expand Up @@ -361,7 +360,7 @@ private bool Init(string path, FileMode mode, FileAccess access, FileShare share
if (_isLocked && ((options & FileOptions.DeleteOnClose) != 0) &&
share == FileShare.None && mode == FileMode.OpenOrCreate)
{
FStatCheckIO(this, path, ref status, ref statusHasValue);
FStatCheckIO(path, ref status, ref statusHasValue);

Interop.Sys.FileStatus pathStatus;
if (Interop.Sys.Stat(path, out pathStatus) < 0)
Expand Down Expand Up @@ -476,7 +475,7 @@ private bool CanLockTheFile(Interop.Sys.LockOperations lockOperation, FileAccess
}
}

private void FStatCheckIO(SafeFileHandle handle, string path, ref Interop.Sys.FileStatus status, ref bool statusHasValue)
private void FStatCheckIO(string path, ref Interop.Sys.FileStatus status, ref bool statusHasValue)
{
if (!statusHasValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static bool TryParseThrowFormatException<T>(out T value, out int bytesCon
//
[DoesNotReturn]
[StackTraceHidden]
public static bool TryParseThrowFormatException<T>(ReadOnlySpan<byte> source, out T value, out int bytesConsumed) where T : struct
public static bool TryParseThrowFormatException<T>(ReadOnlySpan<byte> _, out T value, out int bytesConsumed) where T : struct
{
// The parameters to this method are ordered the same as our callers' parameters
// allowing the JIT to avoid unnecessary register swapping or spilling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal readonly ref struct ByReference<T>
private readonly IntPtr _value;
#pragma warning restore CA1823, 169

#pragma warning disable IDE0060
[Intrinsic]
public ByReference(ref T value)
{
Expand All @@ -24,6 +25,7 @@ public ByReference(ref T value)
// or if intrinsic is missed.
throw new PlatformNotSupportedException();
}
#pragma warning restore IDE0060

#pragma warning disable CA1822 // Mark members as static
public ref T Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected IComparer? comparer

// Note: this constructor is a bogus constructor that does nothing
// and is for use only with SyncHashtable.
internal Hashtable(bool trash)
internal Hashtable(bool _)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ public static DateTime UtcNow
}
}

#pragma warning disable IDE0060

// Never called
private static DateTime FromFileTimeLeapSecondsAware(ulong fileTime) => default;

// Never called
private static ulong ToFileTimeLeapSecondsAware(long ticks) => default;

// IsValidTimeWithLeapSeconds is not expected to be called at all for now on non-Windows platforms
internal static bool IsValidTimeWithLeapSeconds(int year, int month, int day, int hour, int minute, DateTimeKind kind) => false;

#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat

// Return any exact bindings that may exist. (This method is not defined on the
// Binder and is used by RuntimeType.)
public static MethodBase? ExactBinding(MethodBase[] match, Type[] types, ParameterModifier[]? modifiers)
public static MethodBase? ExactBinding(MethodBase[] match, Type[] types)
{
if (match == null)
throw new ArgumentNullException(nameof(match));
Expand Down Expand Up @@ -816,7 +816,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat

// Return any exact bindings that may exist. (This method is not defined on the
// Binder and is used by RuntimeType.)
public static PropertyInfo? ExactPropertyBinding(PropertyInfo[] match, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
public static PropertyInfo? ExactPropertyBinding(PropertyInfo[] match, Type? returnType, Type[]? types)
{
if (match == null)
throw new ArgumentNullException(nameof(match));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ public static partial class Environment
{
// Systems without the Windows registry pretend that it's always empty.

#pragma warning disable IDE0060
private static string? GetEnvironmentVariableFromRegistry(string variable, bool fromMachine) => null;
#pragma warning restore IDE0060

private static void SetEnvironmentVariableFromRegistry(string variable, string? value, bool fromMachine) { }
static partial void SetEnvironmentVariableFromRegistry(string variable, string? value, bool fromMachine);

#pragma warning disable IDE0060
private static IDictionary GetEnvironmentVariablesFromRegistry(bool fromMachine) => new Hashtable();
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ internal static long TimeToTicks(int hour, int minute, int second, int milliseco

internal static int GetSystemTwoDigitYearSetting(CalendarId CalID, int defaultYearValue)
{
int twoDigitYearMax = GlobalizationMode.UseNls ? CalendarData.NlsGetTwoDigitYearMax(CalID) : CalendarData.IcuGetTwoDigitYearMax(CalID);
int twoDigitYearMax = GlobalizationMode.UseNls ? CalendarData.NlsGetTwoDigitYearMax(CalID) : CalendarData.IcuGetTwoDigitYearMax();
return twoDigitYearMax >= 0 ? twoDigitYearMax : defaultYearValue;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private bool IcuLoadCalendarDataFromSystem(string localeName, CalendarId calenda
return result;
}

internal static int IcuGetTwoDigitYearMax(CalendarId calendarId)
internal static int IcuGetTwoDigitYearMax()
{
Debug.Assert(!GlobalizationMode.UseNls);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ internal sealed partial class CalendarData
private bool LoadCalendarDataFromSystemCore(string localeName, CalendarId calendarId) =>
IcuLoadCalendarDataFromSystem(localeName, calendarId);

#pragma warning disable IDE0060
internal static int GetCalendarsCore(string localeName, bool useUserOverride, CalendarId[] calendars) =>
IcuGetCalendars(localeName, calendars);
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private unsafe string IcuGetTimeFormatString(bool shortFormat)
}

// no support to lookup by region name, other than the hard-coded list in CultureData
private static CultureData? IcuGetCultureDataFromRegionName(string? regionName) => null;
private static CultureData? IcuGetCultureDataFromRegionName() => null;

private string IcuGetLanguageDisplayName(string cultureName) => IcuGetLocaleInfo(cultureName, LocaleStringData.LocalizedDisplayName, CultureInfo.CurrentUICulture.Name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ internal sealed partial class CultureData
{
private bool InitCultureDataCore() => InitIcuCultureDataCore();

private void InitUserOverride(bool useUserOverride)
{
// Unix doesn't support user overrides
_bUseOverrides = false;
eerhardt marked this conversation as resolved.
Show resolved Hide resolved
}
// Unix doesn't support user overrides
partial void InitUserOverride(bool useUserOverride);

private static string? LCIDToLocaleName(int culture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ internal sealed partial class CultureData
// If not found in the hard coded table we'll have to find a culture that works for us
if (!GlobalizationMode.Invariant && (retVal == null || retVal.IsNeutralCulture))
{
retVal = GlobalizationMode.UseNls ? NlsGetCultureDataFromRegionName(cultureName) : IcuGetCultureDataFromRegionName(cultureName);
retVal = GlobalizationMode.UseNls ? NlsGetCultureDataFromRegionName(cultureName) : IcuGetCultureDataFromRegionName();
}

// If we found one we can use, then cache it for next time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5229,7 +5229,7 @@ private static string Hex(char c)

private static void Trace(string s)
{
// Internal.Console.WriteLine(s);
Internal.Console.WriteLine(s);
marek-safar marked this conversation as resolved.
Show resolved Hide resolved
}

// for testing; do not make this readonly
Expand Down
Loading