Auto merge of #10705 - Muscraft:workspace-source-fmt-key, r=epage
Auto merge of #10705 - Muscraft:workspace-source-fmt-key, r=epage

fix key formatting when switching to a dotted `WorkspaceSource`

This fell out of #10697 see [this comment](https://github.com/rust-lang/cargo/pull/10697#discussion_r882691624)

There was a small issue where changing the source of a `cargo_add::Dependency` to a `WorkspaceSource` would cause the dotted version to have extra space.

```toml
dep .workspace = true
dep.workspace = true
```

This makes sure the key is formatted as well as adds a unit test to make sure this doesn't come back up in the future.

r? `@epage`

rust-lang/cargo,rustyhorde/cargo,nipunn1313/cargo,rustyhorde/cargo,eminence/cargo,rustyhorde/cargo,rust-lang/cargo,rust-lang/cargo,rust-lang/cargo,eminence/cargo,eminence/cargo,nipunn1313/cargo,nipunn1313/cargo,nipunn1313/cargo,rustyhorde/cargo,eminence/cargo