Formatting is another.
Boilerplate code, for example today I had to implemented code like this:
impl Into<Node> for ProcessNode { fn into(self) -> Node { Node {some_boilerplate(self)} } }
* Implemented it once
* Duplicated it 5x
* Copied the names of the types I needed to impl for
* Attached a cursor to each impl
* Used ctrl + left/ right to word-jump, and past in the appropriate area
Now it's not like this saved me more than a minute or two, but this sort of thing is extremely common in my experience, across languages.
for x in type1 type2 type3 type4 type5 type6 ; do cat <<! impl Into<$x> for ProcessNode { fn into(self) -> $x { $x {some_boilerplate(self)} } } ! done
Poof! The above is replaced with the following:
impl Into<type1> for ProcessNode { fn into(self) -> type1 { type1 {some_boilerplate(self)} } } impl Into<type2> for ProcessNode { fn into(self) -> type2 { type2 {some_boilerplate(self)} } } impl Into<type3> for ProcessNode { fn into(self) -> type3 { type3 {some_boilerplate(self)} } } impl Into<type4> for ProcessNode { fn into(self) -> type4 { type4 {some_boilerplate(self)} } } impl Into<type5> for ProcessNode { fn into(self) -> type5 { type5 {some_boilerplate(self)} } } impl Into<type6> for ProcessNode { fn into(self) -> type6 { type6 {some_boilerplate(self)} } }
Formatting is another.
Boilerplate code, for example today I had to implemented code like this:
I had 6 node types. Using multiple cursors I:* Implemented it once
* Duplicated it 5x
* Copied the names of the types I needed to impl for
* Attached a cursor to each impl
* Used ctrl + left/ right to word-jump, and past in the appropriate area
Now it's not like this saved me more than a minute or two, but this sort of thing is extremely common in my experience, across languages.