How do I remove an unused patch? I'm trying, for the first time, to add a patch in composer.json, for a layout builder issue (https://www.drupal.org/project/drupal/issues/3045171#comment-13450756).

It's the first time I do it, I see that after using the patch composer creates a "b" directory in inside the "core" directory.

The question is: when I'll upgrade the core version what should I do, if the patch will be include in the next release? Remove patch from composer.json? And what about that "b" directory?

I've added this code in the "extra" section of my composer.json and before I've installed the cweagans/composer-patches plugin, with composer:

"patches": {
  "drupal/core": {
    "#3045171-140: Forms break Layout Builder saving.": "https://www.drupal.org/files/issues/2020-02-04/layout-builder-save-issue-3045171-140.patch"
    }
  },
"enable-patching": true
Once you removed the patch from composer.json and run updates, core directory will be overridden by the new release and here the "b" directory will be removed. 

For best practices reasons, I invite you to manage your project patches using composer patches plugin, and to be more specific use external patch file method.