change: Improve consistency in string declaration whenever suitable

This commit is contained in:
SinTan1729
2023-05-23 17:58:57 -05:00
parent ff0a17e57b
commit 7b59a9aa5c
4 changed files with 9 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ pub fn get_longurl(shortlink: String, db: &Connection) -> String {
if validate_link(&shortlink) {
database::find_url(shortlink.as_str(), db)
} else {
"".to_string()
String::new()
}
}
@@ -23,7 +23,7 @@ pub fn getall(db: &Connection) -> String {
pub fn add_link(req: String, db: &Connection) -> (bool, String) {
let chunks: Vec<&str> = req.split(';').collect();
let longlink = chunks[0].to_string();
let longlink = String::from(chunks[0]);
let mut shortlink;
if chunks.len() > 1 {
@@ -41,7 +41,7 @@ pub fn add_link(req: String, db: &Connection) -> (bool, String) {
shortlink,
)
} else {
(false, "shortUrl not valid or already in use".to_string())
(false, String::from("shortUrl not valid or already in use"))
}
}