Skip to content

Commit c31711d

Browse files
authored
Merge pull request #214 from cakebaker/refactor_use_better_names
refactor: rename a function name and a var name
2 parents ea5d61b + c87e103 commit c31711d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/items/timezone.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn timezone_name_offset(input: &mut &str) -> ModalResult<Offset> {
187187
/// than 6 charactres
188188
const MAX_TZ_SIZE: usize = 6;
189189
let nextword = s(take_while(1..=MAX_TZ_SIZE, AsChar::is_alpha)).parse_next(input)?;
190-
let tz = tzname_to_offset(nextword)?;
190+
let tz = timezone_name_to_offset(nextword)?;
191191

192192
// Strings like "UTC +8 years" are ambiguous, they can either be parsed as
193193
// "UTC+8" and "years", or "UTC" and "+8 years". GNU date parses them the
@@ -197,9 +197,9 @@ fn timezone_name_offset(input: &mut &str) -> ModalResult<Offset> {
197197
if peek(relative::parse).parse_next(input).is_err() {
198198
let start = input.checkpoint();
199199
if let Ok(other_tz) = timezone_num.parse_next(input) {
200-
let newtz = tz.merge(other_tz);
200+
let new_tz = tz.merge(other_tz);
201201

202-
return Ok(newtz);
202+
return Ok(new_tz);
203203
};
204204
input.reset(&start);
205205
}
@@ -212,7 +212,7 @@ fn timezone_name_offset(input: &mut &str) -> ModalResult<Offset> {
212212
/// The full list of timezones can be extracted from
213213
/// https://www.timeanddate.com/time/zones/. GNU date only supports a subset of
214214
/// these. We support the same subset as GNU date.
215-
fn tzname_to_offset(input: &str) -> ModalResult<Offset> {
215+
fn timezone_name_to_offset(input: &str) -> ModalResult<Offset> {
216216
let mut offset_str = match input {
217217
"z" => Ok("+0"),
218218
"y" => Ok("-12"),

0 commit comments

Comments
 (0)