refactor: modernize codebase for rust edition 2021

This commit is contained in:
Erica Marigold 2023-09-06 13:05:18 +05:30
parent 9965c3355c
commit 85043c4a3e
No known key found for this signature in database
GPG key ID: 23CD97ABBBCC5ED2
14 changed files with 22 additions and 62 deletions

View file

@ -1,5 +1,5 @@
[package] [package]
name = "chrono_locale" name = "chrono_lc"
version = "0.1.2" version = "0.1.2"
edition = "2021" edition = "2021"
authors = ["Alessandro Pellizzari <alex@amiran.it>", "Erica Marigold <hi@devcomp.xyz>"] authors = ["Alessandro Pellizzari <alex@amiran.it>", "Erica Marigold <hi@devcomp.xyz>"]

View file

@ -9,14 +9,14 @@ Put this in your Cargo.toml:
```toml ```toml
[dependencies] [dependencies]
chrono = "0.4.56" chrono = "0.4.56"
chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" } chrono_lc = "0.1.2"
``` ```
Then put this in your `lib.rs` or `main.rs`: Then put this in your `lib.rs` or `main.rs`:
```rs ```rs
use chrono::prelude::*; use chrono::prelude::*;
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
``` ```
You can choose to import just parts of chrono instead of the whole prelude. You can choose to import just parts of chrono instead of the whole prelude.
@ -26,11 +26,11 @@ To format a chrono `Date` or `DateTime` object, you can use the `formatl` method
```rs ```rs
let dt = FixedOffset::east_opt(34200) let dt = FixedOffset::east_opt(34200)
.unwrap() .unwrap()
.with_ymd_and_hms(2001, 7, 8, 0, 34, 59) .with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
.unwrap() .unwrap()
.with_nanosecond(1_026_490_708) .with_nanosecond(1_026_490_708)
.unwrap(); .unwrap();
println!("{}", dt.formatl("%c", "fr")); println!("{}", dt.formatl("%c", "fr"));
``` ```

View file

@ -1,9 +1,4 @@
extern crate serde; use serde_derive::Deserialize;
extern crate walkdir;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
use serde_json::Error as JsonError; use serde_json::Error as JsonError;
use std::env; use std::env;
use std::fs::File; use std::fs::File;

View file

@ -8,17 +8,14 @@
//! ```toml //! ```toml
//! [dependencies] //! [dependencies]
//! chrono = "0.4" //! chrono = "0.4"
//! chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" } //! chrono_lc = "0.1.2"
//! ``` //! ```
//! //!
//! Then put this in your `lib.rs` or `main.rs`: //! Then put this in your `lib.rs` or `main.rs`:
//! //!
//! ```rust //! ```rust
//! extern crate chrono;
//! extern crate chrono_locale;
//!
//! use chrono::prelude::*; //! use chrono::prelude::*;
//! use chrono_locale::LocaleDate; //! use chrono_lc::LocaleDate;
//! ``` //! ```
//! //!
//! You can choose to import just parts of chrono instead of the whole prelude. //! You can choose to import just parts of chrono instead of the whole prelude.
@ -28,7 +25,7 @@
//! //!
//! ```rust //! ```rust
//! # use chrono::prelude::*; //! # use chrono::prelude::*;
//! # use chrono_locale::LocaleDate; //! # use chrono_lc::LocaleDate;
//! //!
//! let dt = FixedOffset::east_opt(34200) //! let dt = FixedOffset::east_opt(34200)
//! .unwrap() //! .unwrap()
@ -60,8 +57,6 @@
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
extern crate chrono;
extern crate num_integer;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt; use std::fmt;

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]

View file

@ -1,8 +1,5 @@
extern crate chrono;
extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_lc::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]