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

Enable IDE0200 (remove unnecessary lambda expression) #7916

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ dotnet_diagnostic.IDE0170.severity = none # TODO: warning
dotnet_diagnostic.IDE0180.severity = suggestion

# IDE0200: Remove unnecessary lambda expression
dotnet_diagnostic.IDE0200.severity = none # TODO: warning
dotnet_diagnostic.IDE0200.severity = warning

# IDE0210: Use top-level statements
dotnet_diagnostic.IDE0210.severity = silent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
_currentContext = context;

// Child modal dialog - launching in SystemAware mode.
CollectionForm localCollectionForm = DpiHelper.CreateInstanceInSystemAwareContext(() => CreateCollectionForm());
CollectionForm localCollectionForm = DpiHelper.CreateInstanceInSystemAwareContext(CreateCollectionForm);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, this used to have inferior perf characteristics, I have to dig for details though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer the case based on https://devblogs.microsoft.com/dotnet/performance_improvements_in_net_7/#analyzers

I think this was the related change dotnet/roslyn#58288

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the link, this is what I was referring to.

ITypeDescriptorContext lastContext = _currentContext;
localCollectionForm.EditValue = value;
_ignoreChangingEvents = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ protected void OnMenuPaste(object sender, EventArgs e)
return; // nothing we can do here!

IDataObject dataObj = null;
bool clipboardOperationSuccessful = ExecuteSafely(() => Clipboard.GetDataObject(), false, out dataObj);
bool clipboardOperationSuccessful = ExecuteSafely(Clipboard.GetDataObject, false, out dataObj);

if (clipboardOperationSuccessful)
{
Expand Down Expand Up @@ -3505,7 +3505,7 @@ protected void OnStatusPaste(object sender, EventArgs e)
// Not being inherited. Now look at the contents of the data
//
IDataObject dataObj = null;
bool clipboardOperationSuccessful = ExecuteSafely(() => Clipboard.GetDataObject(), false, out dataObj);
bool clipboardOperationSuccessful = ExecuteSafely(Clipboard.GetDataObject, false, out dataObj);

bool enable = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public object GetHandler(Type handlerType)

Debug.Assert(_handlers.Count > 0, "Should have handlers to look through.");

object handler = _handlers.FirstOrDefault(h => handlerType.IsInstanceOfType(h));
object handler = _handlers.FirstOrDefault(handlerType.IsInstanceOfType);

if (handler != null)
{
Expand Down