aboutsummaryrefslogtreecommitdiff
path: root/docs/posts/rapid_refactoring_with_vim
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-04-16 16:10:45 +0100
committerAkshay <[email protected]>2020-04-16 16:10:45 +0100
commitada45c1bea838e5f38f24fe37e558c1b7959ae28 (patch)
treef163cfc35f2080cc7ff4decdaec0b574e314b3a8 /docs/posts/rapid_refactoring_with_vim
parent26af9ac49c3b05151f23ca1087bb06708e97a096 (diff)
redo pandoc commands to print fragments only
Diffstat (limited to 'docs/posts/rapid_refactoring_with_vim')
-rw-r--r--docs/posts/rapid_refactoring_with_vim/index.html75
1 files changed, 7 insertions, 68 deletions
diff --git a/docs/posts/rapid_refactoring_with_vim/index.html b/docs/posts/rapid_refactoring_with_vim/index.html
index 36d06fc..c5bc188 100644
--- a/docs/posts/rapid_refactoring_with_vim/index.html
+++ b/docs/posts/rapid_refactoring_with_vim/index.html
@@ -2,6 +2,7 @@
2<html lang="en"> 2<html lang="en">
3 <head> 3 <head>
4 <link rel="stylesheet" href="/style.css"> 4 <link rel="stylesheet" href="/style.css">
5 <link rel="stylesheet" href="/syntax.css">
5 <meta charset="UTF-8"> 6 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1"> 7 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color"> 8 <meta content="#ffffff" name="theme-color">
@@ -37,71 +38,7 @@
37 Rapid Refactoring With Vim 38 Rapid Refactoring With Vim
38 </h1> 39 </h1>
39 <div class="post-text"> 40 <div class="post-text">
40 <!DOCTYPE html> 41 <p>Last weekend, I was tasked with refactoring the 96 unit tests on <a href="https://github.com/ruma/ruma-events/pull/70">ruma-events</a> to use strictly typed json objects using <code>serde_json::json!</code> instead of raw strings. It was rather painless thanks to vim :)</p>
41<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
42<head>
43 <meta charset="utf-8" />
44 <meta name="generator" content="pandoc" />
45 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
46 <title>rapid_refactoring_with_vim</title>
47 <style>
48 code{white-space: pre-wrap;}
49 span.smallcaps{font-variant: small-caps;}
50 span.underline{text-decoration: underline;}
51 div.column{display: inline-block; vertical-align: top; width: 50%;}
52 div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
53 ul.task-list{list-style: none;}
54 pre > code.sourceCode { white-space: pre; position: relative; }
55 pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
56 pre > code.sourceCode > span:empty { height: 1.2em; }
57 code.sourceCode > span { color: inherit; text-decoration: inherit; }
58 div.sourceCode { margin: 1em 0; }
59 pre.sourceCode { margin: 0; }
60 @media screen {
61 div.sourceCode { overflow: auto; }
62 }
63 @media print {
64 pre > code.sourceCode { white-space: pre-wrap; }
65 pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
66 }
67 pre.numberSource code
68 { counter-reset: source-line 0; }
69 pre.numberSource code > span
70 { position: relative; left: -4em; counter-increment: source-line; }
71 pre.numberSource code > span > a:first-child::before
72 { content: counter(source-line);
73 position: relative; left: -1em; text-align: right; vertical-align: baseline;
74 border: none; display: inline-block;
75 -webkit-touch-callout: none; -webkit-user-select: none;
76 -khtml-user-select: none; -moz-user-select: none;
77 -ms-user-select: none; user-select: none;
78 padding: 0 4px; width: 4em;
79 }
80 pre.numberSource { margin-left: 3em; padding-left: 4px; }
81 div.sourceCode
82 { }
83 @media screen {
84 pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85 }
86 code span.al { font-weight: bold; } /* Alert */
87 code span.an { font-style: italic; } /* Annotation */
88 code span.cf { font-weight: bold; } /* ControlFlow */
89 code span.co { font-style: italic; } /* Comment */
90 code span.cv { font-style: italic; } /* CommentVar */
91 code span.do { font-style: italic; } /* Documentation */
92 code span.dt { text-decoration: underline; } /* DataType */
93 code span.er { font-weight: bold; } /* Error */
94 code span.in { font-style: italic; } /* Information */
95 code span.kw { font-weight: bold; } /* Keyword */
96 code span.pp { font-weight: bold; } /* Preprocessor */
97 code span.wa { font-style: italic; } /* Warning */
98 </style>
99 <!--[if lt IE 9]>
100 <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
101 <![endif]-->
102</head>
103<body>
104<p>Last weekend, I was tasked with refactoring the 96 unit tests on <a href="https://github.com/ruma/ruma-events/pull/70">ruma-events</a> to use strictly typed json objects using <code>serde_json::json!</code> instead of raw strings. It was rather painless thanks to vim :)</p>
105<p>Here’s a small sample of what had to be done (note the lines prefixed with the arrow):</p> 42<p>Here’s a small sample of what had to be done (note the lines prefixed with the arrow):</p>
106<div class="sourceCode" id="cb1"><pre class="sourceCode rust"><code class="sourceCode rust"><span id="cb1-1"><a href="#cb1-1"></a>→ <span class="kw">use</span> <span class="pp">serde_json::</span><span class="op">{</span>from_str<span class="op">};</span></span> 43<div class="sourceCode" id="cb1"><pre class="sourceCode rust"><code class="sourceCode rust"><span id="cb1-1"><a href="#cb1-1"></a>→ <span class="kw">use</span> <span class="pp">serde_json::</span><span class="op">{</span>from_str<span class="op">};</span></span>
107<span id="cb1-2"><a href="#cb1-2"></a> </span> 44<span id="cb1-2"><a href="#cb1-2"></a> </span>
@@ -190,13 +127,15 @@ BUFFER: json!( ... );</code></pre>
190<li id="fn4" role="doc-endnote"><p><code>:help mark-motions</code><a href="#fnref4" class="footnote-back" role="doc-backlink">↩︎</a></p></li> 127<li id="fn4" role="doc-endnote"><p><code>:help mark-motions</code><a href="#fnref4" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
191</ol> 128</ol>
192</section> 129</section>
193</body>
194</html>
195 130
196 </div> 131 </div>
197 132
198 <div class=intro> 133 <div class=intro>
199 Hi. <a href=https://peppe.rs/index.xml class=feed-button>Subscribe</a> 134 Hi.
135 <div class=hot-links>
136 <a href=https://peppe.rs/index.xml class=feed-button>Subscribe</a>
137 <a href=https://liberapay.com/nerdypepper/donate class=donate-button>Donate</a>
138 </div>
200 <p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p> 139 <p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p>
201 <p> 140 <p>
202 I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer. 141 I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer.