aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-07-25 16:57:23 +0200
committerTeddy Wing2020-07-25 16:57:23 +0200
commitd97f26047d8353ef3372bacde2a1e233c4f2a2d8 (patch)
treef26f1a3f650e6c565cc3ca5a60181ca41384a397
parentfe0290e043cdaa533c071aa62eb922b4cf105625 (diff)
downloadgit-suggestion-d97f26047d8353ef3372bacde2a1e233c4f2a2d8.tar.bz2
Suggestion: Rename `suggestion` field to `comment`
The name "suggestion" sounds like the suggested diff change, when really this field will be deserialised with the whole GitHub comment, including adjacent text as well as the suggestion.
-rw-r--r--src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ce0a2ff..b5a1ccb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -66,7 +66,7 @@ pub struct Suggestion {
diff: String,
#[serde(rename = "body")]
- suggestion: String,
+ comment: String,
path: String,
@@ -98,7 +98,7 @@ impl Suggestion {
fn suggestion(&self) -> String {
let re = Regex::new(r"(?s).*(?-s)```\s*suggestion.*\n").unwrap();
- let s = re.replace(&self.suggestion, "+");
+ let s = re.replace(&self.comment, "+");
s.replace("```", "")
}
@@ -172,7 +172,7 @@ mod tests {
"fmt"
"io"
+ "os" // used to input comment"#.to_owned(),
- suggestion: r#"It's ok to leave these uncommented
+ comment: r#"It's ok to leave these uncommented
```suggestion
"os"