Rider static analysis (#433)

* Non-accessed local variable

* Merge cast and type checks.

* StringComparison.Ordinal added for better culture support

* Supposed code improvement in launcher. Remove unused code.

* Update ExplosionHelper.cs

Unintentional change.

* Optimized Import

* Add Robust.Shared.Utility import where it was deleted

* Other random suggestion

* Improve my comment
This commit is contained in:
ZelteHonor
2019-11-13 17:37:46 -05:00
committed by Pieter-Jan Briers
parent 62b31eee00
commit b2e2aef78d
138 changed files with 190 additions and 400 deletions

View File

@@ -225,7 +225,7 @@ namespace Content.Client.Construction
PopulateTree(string.IsNullOrWhiteSpace(str) ? null : str.ToLowerInvariant());
}
void OnBuildPressed(Button.ButtonEventArgs args)
void OnBuildPressed(BaseButton.ButtonEventArgs args)
{
var prototype = (ConstructionPrototype) RecipeList.Selected.Metadata;
if (prototype == null)
@@ -332,7 +332,7 @@ namespace Content.Client.Construction
{
var found = false;
// TODO: don't run ToLowerInvariant() constantly.
if (prototype.Name.ToLowerInvariant().IndexOf(searchTerm) != -1)
if (prototype.Name.ToLowerInvariant().IndexOf(searchTerm, StringComparison.Ordinal) != -1)
{
found = true;
}
@@ -341,7 +341,7 @@ namespace Content.Client.Construction
foreach (var keyw in prototype.Keywords.Concat(prototype.CategorySegments))
{
// TODO: don't run ToLowerInvariant() constantly.
if (keyw.ToLowerInvariant().IndexOf(searchTerm) != -1)
if (keyw.ToLowerInvariant().IndexOf(searchTerm, StringComparison.Ordinal) != -1)
{
found = true;
break;
@@ -369,7 +369,7 @@ namespace Content.Client.Construction
private static int ComparePrototype(ConstructionPrototype x, ConstructionPrototype y)
{
return x.Name.CompareTo(y.Name);
return String.Compare(x.Name, y.Name, StringComparison.Ordinal);
}
class CategoryNode

View File

@@ -1,14 +1,11 @@
using Content.Client.GameObjects.Components.Construction;
using Content.Shared.Construction;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Placement;
using Robust.Client.ResourceManagement;
using Robust.Client.Utility;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Content.Client.Construction
{
@@ -46,7 +43,6 @@ namespace Content.Client.Construction
{
base.StartHijack(manager);
var res = IoCManager.Resolve<IResourceCache>();
manager.CurrentBaseSprite = Prototype.Icon.DirFrame0();
}
}