This commit is contained in:
howardwu 2021-02-24 19:43:03 -08:00
parent c76cb0b086
commit 9206d55408
2 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ impl Command for Init {
fn apply(self, _: Context, _: Self::Input) -> Result<Self::Output> {
// Derive the package directory path.
let mut path = current_dir()?;
let path = current_dir()?;
// Check that the given package name is valid.
let package_name = path

View File

@ -55,12 +55,12 @@ impl Package {
/// by a single dash '-'.
pub fn is_package_name_valid(package_name: &str) -> bool {
// Check that the package name is nonempty.
if package_name.len() == 0 {
if package_name.is_empty() {
tracing::error!("Project names must be nonempty");
return false;
}
let mut previous = package_name.chars().nth(0).unwrap();
let mut previous = package_name.chars().next().unwrap();
// Check that the first character is not a dash.
if previous == '-' {