Skip to content

Commit

Permalink
Resolve some warnings about string comparisons (#1757)
Browse files Browse the repository at this point in the history
  • Loading branch information
BCSharp authored Dec 11, 2023
1 parent 9aa48ff commit 0be3c1c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Src/DLR
2 changes: 1 addition & 1 deletion Src/IronPython/Runtime/Operations/StringOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,7 @@ static CodecsInfo() {
#if DEBUG
foreach (KeyValuePair<string, Lazy<Encoding?>> kvp in d) {
// all codecs should be stored in lowercase because we only look up from lowercase strings
Debug.Assert(kvp.Key.ToLower(CultureInfo.InvariantCulture) == kvp.Key);
Debug.Assert(kvp.Key.Equals(kvp.Key, StringComparison.OrdinalIgnoreCase));
// all codec names should use underscores instead of dashes to match lookup values
Debug.Assert(kvp.Key.IndexOf('-') < 0);
}
Expand Down
3 changes: 2 additions & 1 deletion Src/IronPythonTest/Util/IniParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ private static OptionStore Parse(IEnumerable<string> lines) {

if (string.IsNullOrEmpty(line)) continue;

if (line.StartsWith("[", StringComparison.Ordinal) && line.EndsWith("]", StringComparison.Ordinal)) {
//if (line.StartsWith('[', StringComparison.Ordinal) && line.EndsWith(']', StringComparison.Ordinal)) {
if (line.Length >= 2 && line[0] == '[' && line[line.Length - 1] == ']') {
var sectionName = line.Substring(1, line.Length - 2);
if (!options.TryGetValue(sectionName, out currentSection)) {
currentSection = new Section();
Expand Down

0 comments on commit 0be3c1c

Please sign in to comment.