From d97f26047d8353ef3372bacde2a1e233c4f2a2d8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 25 Jul 2020 16:57:23 +0200 Subject: 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. --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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" -- cgit v1.2.3