aboutsummaryrefslogtreecommitdiff
path: root/src/datastructures.rs
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2021-05-08 01:24:07 +0800
committerKunoiSayami <[email protected]>2021-05-08 01:24:07 +0800
commita3eaa8611425c87ef940215650bad6668464c301 (patch)
treefa8169a7344eb1bfba65254b3eecc7a86e03f20f /src/datastructures.rs
parent86e4c76dabb20b7f489abcb1f1c3cdb11a494b91 (diff)
style: Address cargo fmt
Diffstat (limited to 'src/datastructures.rs')
-rw-r--r--src/datastructures.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/datastructures.rs b/src/datastructures.rs
index b920eb4..0438b70 100644
--- a/src/datastructures.rs
+++ b/src/datastructures.rs
@@ -18,12 +18,12 @@
** along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use sha2::Digest;
use anyhow::Result;
-use url::form_urlencoded;
+use sha2::Digest;
use std::borrow::Cow;
-use std::path::Path;
use std::fs::read_to_string;
+use std::path::Path;
+use url::form_urlencoded;
const DEFAULT_CONFIG_LOCATION: &str = "/etc/cgitrc";
const DEFAULT_COOKIE_TTL: u64 = 1200;
@@ -56,10 +56,9 @@ impl Config {
let mut cookie_ttl: u64 = DEFAULT_COOKIE_TTL;
let mut database: &str = "/etc/cgit/auth.db";
for line in file.lines() {
-
let line = line.trim();
if !line.contains('=') || !line.starts_with("cgit-simple-auth-") {
- continue
+ continue;
}
let (key, value) = if line.contains('#') {
@@ -76,7 +75,7 @@ impl Config {
}
Self {
cookie_ttl,
- database: database.to_string()
+ database: database.to_string(),
}
}
@@ -85,7 +84,6 @@ impl Config {
}
}
-
#[derive(Debug, Clone, Default)]
pub struct FormData {
user: String,
@@ -95,7 +93,9 @@ pub struct FormData {
impl FormData {
pub fn new() -> Self {
- Self { ..Default::default()}
+ Self {
+ ..Default::default()
+ }
}
pub fn get_string_sha256_value(s: &str) -> Result<String> {
@@ -165,4 +165,4 @@ impl From<String> for FormData {
fn from(s: String) -> Self {
Self::from(&s)
}
-} \ No newline at end of file
+}