From 2ed2d271ca3a3a445741e179a04e1760ea01f142 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Thu, 26 Sep 2024 07:08:04 +0800 Subject: [PATCH] Fix typos --- crates/oro-node-semver/README.md | 2 +- crates/oro-node-semver/src/version_req.rs | 4 ++-- src/commands/add.rs | 2 +- src/commands/cache.rs | 2 +- src/commands/watch.rs | 6 +++--- src/core/net.rs | 2 +- src/core/prompt/input.rs | 2 +- src/core/utils/errors.rs | 10 +++++----- src/core/utils/mod.rs | 6 +++--- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/oro-node-semver/README.md b/crates/oro-node-semver/README.md index 70e64909..275a8300 100644 --- a/crates/oro-node-semver/README.md +++ b/crates/oro-node-semver/README.md @@ -3,7 +3,7 @@ TODO: -https://github.com/dart-lang/pub_semver/blob/master/lib/src/version_range.dart cotains a good impl of below operations needed for PubGrub +https://github.com/dart-lang/pub_semver/blob/master/lib/src/version_range.dart contains a good impl of below operations needed for PubGrub * bool allowsAll(VersionConstraint other); diff --git a/crates/oro-node-semver/src/version_req.rs b/crates/oro-node-semver/src/version_req.rs index fd134164..4fc4d089 100644 --- a/crates/oro-node-semver/src/version_req.rs +++ b/crates/oro-node-semver/src/version_req.rs @@ -667,7 +667,7 @@ where move |input: &'a str| { context( "hyphenated", - map(tuple((&left, spaced_hypen, &right)), |(l, _, r)| (l, r)), + map(tuple((&left, spaced_hyphen, &right)), |(l, _, r)| (l, r)), )(input) } } @@ -725,7 +725,7 @@ fn no_operation_followed_by_version<'a>( )(input) } -fn spaced_hypen<'a>(input: &'a str) -> IResult<&'a str, (), SemverParseError<&'a str>> { +fn spaced_hyphen<'a>(input: &'a str) -> IResult<&'a str, (), SemverParseError<&'a str>> { map(tuple((space0, tag("-"), space0)), |_| ())(input) } diff --git a/src/commands/add.rs b/src/commands/add.rs index cc0a823a..e2c833fb 100644 --- a/src/commands/add.rs +++ b/src/commands/add.rs @@ -72,7 +72,7 @@ impl VoltCommand for Add { requested, } = package { - // recieve the version of a package that has been requested from the response + // receive the version of a package that has been requested from the response if *name == response.name { requested_packages.push(PackageSpec::Npm { scope: scope.to_owned(), diff --git a/src/commands/cache.rs b/src/commands/cache.rs index 0c4f6a1f..fe03a028 100644 --- a/src/commands/cache.rs +++ b/src/commands/cache.rs @@ -38,7 +38,7 @@ pub struct Cache {} #[async_trait] impl Command for Cache { - /// Display a help menu for the `volt cahe` command. + /// Display a help menu for the `volt cache` command. fn help() -> String { format!( r#"volt {} diff --git a/src/commands/watch.rs b/src/commands/watch.rs index cfbd7c05..4b422af1 100644 --- a/src/commands/watch.rs +++ b/src/commands/watch.rs @@ -224,20 +224,20 @@ impl VoltCommand for Watch { // progress_bar.finish_with_message(""); // let node_modules = read_dir("node_modules").unwrap(); - // let mut availiable_modules: Vec = vec![]; + // let mut available_modules: Vec = vec![]; // for entry in node_modules { // let entry = entry.unwrap(); // if entry.path().is_dir() { // let path = entry.file_name().to_str().unwrap().to_string(); - // availiable_modules.push(path); + // available_modules.push(path); // } // } // let mut missing_modules: Vec = vec![]; // for module in modules { - // if !availiable_modules.contains(&module) { + // if !available_modules.contains(&module) { // missing_modules.push(module); // } // } diff --git a/src/core/net.rs b/src/core/net.rs index 7375b15a..7397291c 100644 --- a/src/core/net.rs +++ b/src/core/net.rs @@ -114,7 +114,7 @@ pub async fn get_volt_response(package_spec: &PackageSpec) -> Result Result { - // Recieve the tarball from the npm registry + // Receive the tarball from the npm registry let response = state .http_client .get(&package.tarball) diff --git a/src/core/prompt/input.rs b/src/core/prompt/input.rs index 18a88c4e..5a7fbac8 100644 --- a/src/core/prompt/input.rs +++ b/src/core/prompt/input.rs @@ -309,7 +309,7 @@ where /// The default behaviour is to append [`Self::default`] to the prompt to tell the /// user what is the default value. /// - /// This method does not affect existance of default value, only its display in the prompt! + /// This method does not affect existence of default value, only its display in the prompt! pub fn show_default(&mut self, val: bool) -> &mut Input<'a, T> { self.show_default = val; self diff --git a/src/core/utils/errors.rs b/src/core/utils/errors.rs index 930b45cc..c8747bad 100644 --- a/src/core/utils/errors.rs +++ b/src/core/utils/errors.rs @@ -45,11 +45,11 @@ pub enum VoltError { // #[error("failed to decode lz4 encoded data")] // #[diagnostic(code(volt::decode::lz4::decode))] // DecodeError(#[source] std::io::Error), - #[error("failed to recieve response from the registry")] + #[error("failed to receive response from the registry")] #[diagnostic(code(volt::network))] NetworkError(isahc::Error), - // #[error("failed to recieve byte response")] + // #[error("failed to receive byte response")] // #[diagnostic(code(volt::network::rec))] // NetworkRecError(#[source] std::io::Error), #[error("failed to create directory")] @@ -68,7 +68,7 @@ pub enum VoltError { #[diagnostic(code(volt::registry::volt::bad_request))] BadRequest { url: String }, - #[error("GET {url} - {} - An unknown error occured. Please try again later.")] + #[error("GET {url} - {} - An unknown error occurred. Please try again later.")] #[diagnostic(code(volt::registry::volt::unknown_error))] NetworkUnknownError { url: String, @@ -100,7 +100,7 @@ pub enum VoltError { #[diagnostic(code(volt::network::builder))] _RequestBuilderError(#[source] isahc::http::Error), - #[error("failed to build recieve response text")] + #[error("failed to build receive response text")] #[diagnostic(code(volt::io::rec::text))] _IoTextRecError(#[source] std::io::Error), @@ -132,7 +132,7 @@ pub enum VoltError { #[diagnostic(code(volt::git::parse))] GitConfigParseError { error_text: String }, - #[error("an unknown error occured.")] + #[error("an unknown error occurred.")] #[diagnostic(code(volt::unknown))] _UnknownError, } diff --git a/src/core/utils/mod.rs b/src/core/utils/mod.rs index 12df64c1..01f17e48 100644 --- a/src/core/utils/mod.rs +++ b/src/core/utils/mod.rs @@ -342,14 +342,14 @@ pub fn verify_existing_installation( pub fn verify_checksum( response: &bytes::Bytes, - expeced_checksum: &str, + expected_checksum: &str, ) -> Result<(bool, Option)> { // begin // there are only 2 supported algorithms // sha1 and sha512 // so we can be sure that if it doesn't start with sha1, it's going to have to be sha512 - let algorithm = if expeced_checksum.starts_with("sha1") { + let algorithm = if expected_checksum.starts_with("sha1") { Algorithm::Sha1 } else { Algorithm::Sha512 @@ -357,7 +357,7 @@ pub fn verify_checksum( let calculated_checksum = VoltConfig::calc_hash(response, algorithm)?; - if calculated_checksum == expeced_checksum { + if calculated_checksum == expected_checksum { Ok((true, None)) } else { Ok((false, Some(calculated_checksum)))