commit e0cd436ac1cdbdd66dd2d434c1419dc40bab5cab
parent 0fe261ac20a3b4f5501b30511612f74a1cfe5f2f
Author: cy6erlion <dev@merely.tech>
Date: Tue, 29 Dec 2020 18:39:18 +0200
rename and fix clippy warnings
Diffstat:
6 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -149,6 +149,16 @@ dependencies = [
]
[[package]]
+name = "ietf"
+version = "0.1.0"
+dependencies = [
+ "clap",
+ "dirs-next",
+ "minreq",
+ "pager",
+]
+
+[[package]]
name = "js-sys"
version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -241,16 +251,6 @@ dependencies = [
]
[[package]]
-name = "rfc"
-version = "0.1.0"
-dependencies = [
- "clap",
- "dirs-next",
- "minreq",
- "pager",
-]
-
-[[package]]
name = "ring"
version = "0.16.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "rfc"
+name = "ietf"
version = "0.1.0"
authors = ["cy6erlion <dev@merely.tech>"]
edition = "2018"
diff --git a/README.md b/README.md
@@ -1,16 +1,18 @@
-``` text
-█▀▄ █▀ ▄▀▀
-█▀▄ █▀ ▀▄▄
+``` text▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
+██▄██ ▄▄█▄ ▄█ ▄▄
+██ ▄█ ▄▄██ ██ ▄█
+█▄▄▄█▄▄▄██▄██▄██
+▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
```
``` bash
-$ rfc 0.1.0
+$ ietf 0.1.0
-A program to read RFCs in the terminal.
+A program to read IETF RFCs in the terminal.
USAGE:
- rfc [OPTIONS] [SUBCOMMAND]
+ ietf [OPTIONS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
@@ -38,17 +40,17 @@ To run simply type the following command in the shell to start the RFC
browser:
``` bash
-$ rfc
+$ ietf
```
### Read RFC by number
``` bash
-$ rfc -n 1
+$ ietf -n 1
```
### Update
To update the local RFC index, use the following command:
``` bash
-$ rfc update
+$ ietf update
```
diff --git a/src/fetch.rs b/src/fetch.rs
@@ -33,7 +33,7 @@ pub fn persist_index(index: Vec<String>) {
panic!("Unsupported OS");
};
- let file = File::create(&path).expect("Unable to create file");
+ let _file = File::create(&path).expect("Unable to create file");
let mut file = OpenOptions::new()
.write(true)
.append(true)
@@ -61,7 +61,7 @@ pub fn persist_rfc(sn: u32, rfc: &str) {
panic!("Unsupported OS");
};
- let file = File::create(&path).expect("Unable to create file");
+ let _file = File::create(&path).expect("Unable to create file");
let mut file = OpenOptions::new()
.write(true)
.append(true)
@@ -93,7 +93,7 @@ pub fn scrape(data: &str) -> Vec<String> {
buff = format!("{}{}", buff, line);
}
} else {
- count = count + 1;
+ count += 1;
}
}
diff --git a/src/lib.rs b/src/lib.rs
@@ -98,10 +98,10 @@ fn index_exists() -> Result<bool, ()> {
};
if Path::new(&path).exists() {
- return Ok(true);
+ Ok(true)
} else {
init_storage_sir().unwrap();
- return Ok(false);
+ Ok(false)
}
} else {
panic!("Could not find home directory");
@@ -120,10 +120,10 @@ fn is_rfc_downloaded(sn: u32) -> Result<bool, ()> {
};
if Path::new(&path).exists() {
- return Ok(true);
+ Ok(true)
} else {
init_storage_sir().unwrap();
- return Ok(false);
+ Ok(false)
}
} else {
panic!("Could not find home directory");
@@ -142,10 +142,10 @@ fn init_storage_sir() -> std::io::Result<()> {
};
if Path::new(&path).exists() {
- return Ok(());
+ Ok(())
} else {
std::fs::create_dir(path)?;
- return Ok(());
+ Ok(())
}
} else {
panic!("Could not find home directory");
diff --git a/src/main.rs b/src/main.rs
@@ -1,7 +1,7 @@
use clap::{App, Arg, SubCommand};
fn main() {
- let matches = App::new("rfc")
+ let matches = App::new("ietf")
.version("0.1.0")
.about("A program to read RFCs in the terminal.")
.arg(
@@ -17,7 +17,7 @@ fn main() {
// Read RFC by serial number
if let Some(n) = matches.value_of("Number") {
- rfc::read_rfc(
+ ietf::read_rfc(
n.parse::<u32>()
.expect("RFC Serial Number should be a numeric value!"),
);
@@ -25,11 +25,11 @@ fn main() {
}
// Update RFC index
- if let Some(matches) = matches.subcommand_matches("update") {
- rfc::update();
+ if let Some(_matches) = matches.subcommand_matches("update") {
+ ietf::update();
return;
}
// Display RFC list view
- rfc::list_view();
+ ietf::list_view();
}