Cleanup: instance-style extension calls, redundant generic args, and redundant casts#12583
Conversation
The generic type is inferred from the source collection, so the explicit <string> is unnecessary noise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert static extension-method invocations to instance call syntax: LINQ (Enumerable.FirstOrDefault/Count/ToList), ObservableCollectionExtensions.AddRange, ClipboardExtensions.TryGetTextAsync, UiUtil.RemoveControlFromParent, and SplitToLines. More readable and idiomatic; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop casts that the compiler already provides implicitly or that are no-ops: - redundant numeric casts around Math.Round / division / TimeSpan.FromSeconds where the operand or result type already matches (integer division semantics in AdvancedEffectAudioTextPulse are preserved); - pointless (uint)/(int)/(byte) casts on already-correct types; - (IEnumerable<T>) upcasts left over before LINQ instance calls; - superfluous nullable/reference casts on ternary branches (e.g. : (T?)null). No behavior change; full solution builds clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AI-generated bug fix pull requestsFor future AI-generated bug fix PRs, please limit each pull request to 1–3 related fixes (depending on their size and complexity). Smaller, focused PRs are much easier to review, test, and merge. Please also include a brief manual comment describing how you personally verified each fix. AI-generated code can contain mistakes or unintended side effects, so every submitted change should be tested and validated by the contributor before opening the PR. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Reviewed hunk by hunk with focus on the cast removals, since "redundant" casts around arithmetic are where cleanups silently change semantics. All verified behavior-preserving:
One leftover fixed on top: Full solution builds clean; all 1,496 tests pass (libse, libuilogic, seconv, UI). 🤖 Generated with Claude Code |
Three small, behavior-preserving cleanup commits:
Drop redundant
<string>type argument fromMakeComboBoxcalls — the generic type is inferred from the source collection, so the explicit<string>was just noise. Touches the DCinema SMPTE, iTunes Timed Text, Timed Text 1.0, IMSC 1.1 property windows, and the Cut Video window.Use instance-style extension method calls — convert static extension-method invocations to instance call syntax: LINQ (
Enumerable.FirstOrDefault/Count/ToList),ObservableCollectionExtensions.AddRange,ClipboardExtensions.TryGetTextAsync,UiUtil.RemoveControlFromParent, andSplitToLines.Remove redundant and unnecessary casts — drop casts the compiler already supplies or that are no-ops: redundant numeric casts around
Math.Round/division/TimeSpan.FromSeconds(integer-division semantics preserved), pointless(uint)/(int)/(byte)casts on already-correct types, leftover(IEnumerable<T>)upcasts before LINQ instance calls, and superfluous nullable/reference casts on ternary branches.No behavior change. Full solution builds clean.
🤖 Generated with Claude Code