Browse Source

Make static variables uppercase

master
Dylan Baker 5 years ago
parent
commit
67530d79dc
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      src/entry.rs

+ 6
- 6
src/entry.rs View File

52
 
52
 
53
 pub fn parse_entry(kind: EntryKind, contents: &str, path: &path::Path) -> Entry {
53
 pub fn parse_entry(kind: EntryKind, contents: &str, path: &path::Path) -> Entry {
54
     lazy_static! {
54
     lazy_static! {
55
-        static ref re_with_date: Regex =
55
+        static ref RE_WITH_DATE: Regex =
56
             Regex::new(r"^# (?P<title>.*) \| (?P<date>\d{4}-\d{2}-\d{2})\n\n(?s)(?P<body>.*)")
56
             Regex::new(r"^# (?P<title>.*) \| (?P<date>\d{4}-\d{2}-\d{2})\n\n(?s)(?P<body>.*)")
57
                 .unwrap();
57
                 .unwrap();
58
-        static ref re_without_date: Regex =
58
+        static ref RE_WITHOUT_DATE: Regex =
59
             Regex::new(r"^# (?P<title>.*)\n\n(?s)(?P<body>.*)").unwrap();
59
             Regex::new(r"^# (?P<title>.*)\n\n(?s)(?P<body>.*)").unwrap();
60
-        static ref slug_re: Regex = Regex::new(r"(?P<slug>\S+).md").unwrap();
60
+        static ref SLUG_RE: Regex = Regex::new(r"(?P<slug>\S+).md").unwrap();
61
     }
61
     }
62
 
62
 
63
     let filename = &path.file_name().unwrap().to_str().unwrap();
63
     let filename = &path.file_name().unwrap().to_str().unwrap();
64
-    let slug = slug_re
64
+    let slug = SLUG_RE
65
         .captures(filename)
65
         .captures(filename)
66
         .expect("Couldn't parse slug from filename")["slug"]
66
         .expect("Couldn't parse slug from filename")["slug"]
67
         .to_string();
67
         .to_string();
68
 
68
 
69
     if kind == EntryKind::Post {
69
     if kind == EntryKind::Post {
70
-        let captures = &re_with_date
70
+        let captures = &RE_WITH_DATE
71
             .captures(&contents)
71
             .captures(&contents)
72
             .expect("Couldn't parse post");
72
             .expect("Couldn't parse post");
73
         let title = captures["title"].to_string();
73
         let title = captures["title"].to_string();
83
             date,
83
             date,
84
         }
84
         }
85
     } else {
85
     } else {
86
-        let captures = &re_without_date
86
+        let captures = &RE_WITHOUT_DATE
87
             .captures(&contents)
87
             .captures(&contents)
88
             .expect("Couldn't parse page");
88
             .expect("Couldn't parse page");
89
         let title = captures["title"].to_string();
89
         let title = captures["title"].to_string();

Loading…
Cancel
Save