mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-26 11:06:00 +03:00
clippy: fix single_char_pattern
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
c21b5ad2f3
commit
80bb3033fd
@ -43,10 +43,10 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
|
||||
// Trim starting double quote `"`
|
||||
let mut string = formatted.string.as_str();
|
||||
string = string.trim_start_matches("\"");
|
||||
string = string.trim_start_matches('\"');
|
||||
|
||||
// Trim everything after the ending double quote `"`
|
||||
let parts: Vec<&str> = string.split("\"").collect();
|
||||
let parts: Vec<&str> = string.split('\"').collect();
|
||||
string = parts[0];
|
||||
|
||||
// Insert the parameter for each container `{}`
|
||||
|
@ -40,7 +40,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
span: Span,
|
||||
) -> Result<ConstrainedValue<F, G>, ExpressionError> {
|
||||
// Circuit definitions are located at the minimum file scope
|
||||
let scopes: Vec<&str> = file_scope.split("_").collect();
|
||||
let scopes: Vec<&str> = file_scope.split('_').collect();
|
||||
let mut program_identifier = new_scope(scopes[0].to_string(), identifier.to_string());
|
||||
|
||||
if identifier.is_self() {
|
||||
|
@ -167,7 +167,7 @@ impl CLI for AddCommand {
|
||||
let mut file_path = path.clone();
|
||||
file_path.push(file_name);
|
||||
|
||||
if file_name.ends_with("/") {
|
||||
if file_name.ends_with('/') {
|
||||
create_dir_all(file_path)?;
|
||||
} else {
|
||||
if let Some(parent_directory) = path.parent() {
|
||||
|
@ -56,7 +56,7 @@ impl TryFrom<&PathBuf> for InputPairs {
|
||||
.to_str()
|
||||
.ok_or(InputsDirectoryError::GettingFileName(file.as_os_str().to_owned()))?;
|
||||
|
||||
if file_extension == INPUT_FILE_EXTENSION.trim_start_matches(".") {
|
||||
if file_extension == INPUT_FILE_EXTENSION.trim_start_matches('.') {
|
||||
let input_file = InputFile::new(file_name).read_from(&file)?.0;
|
||||
|
||||
if pairs.contains_key(file_name) {
|
||||
@ -69,7 +69,7 @@ impl TryFrom<&PathBuf> for InputPairs {
|
||||
};
|
||||
pairs.insert(file_name.to_owned(), pair);
|
||||
}
|
||||
} else if file_extension == STATE_FILE_EXTENSION.trim_start_matches(".") {
|
||||
} else if file_extension == STATE_FILE_EXTENSION.trim_start_matches('.') {
|
||||
let state_file = StateFile::new(file_name).read_from(&file)?.0;
|
||||
|
||||
if pairs.contains_key(file_name) {
|
||||
|
@ -139,7 +139,7 @@ impl TryFrom<&PathBuf> for Manifest {
|
||||
// Determine if the old remote format is being used
|
||||
if line.starts_with("remote") {
|
||||
let remote = line
|
||||
.split("=") // Split the line as 'remote' = '"{author}/{package_name}"'
|
||||
.split('=') // Split the line as 'remote' = '"{author}/{package_name}"'
|
||||
.collect::<Vec<&str>>()[1]; // Fetch just '"{author}/{package_name}"'
|
||||
old_remote_format = Some(remote);
|
||||
|
||||
@ -182,7 +182,7 @@ impl TryFrom<&PathBuf> for Manifest {
|
||||
if !new_remote_format_exists {
|
||||
// Fetch the author from the old remote.
|
||||
let remote_author = old_remote
|
||||
.split("/") // Split the old remote as '"{author}' and '{package_name}"'
|
||||
.split('/') // Split the old remote as '"{author}' and '{package_name}"'
|
||||
.collect::<Vec<&str>>()[0] // Fetch just the '"{author}'
|
||||
.replace(&['\"', ' '][..], ""); // Remove the quotes from the author string
|
||||
|
||||
|
@ -150,23 +150,23 @@ impl ZipFile {
|
||||
/// Check if the file path should be included in the package zip file.
|
||||
fn is_included(path: &Path) -> bool {
|
||||
// excluded directories: `input`, `output`, `imports`
|
||||
if path.ends_with(INPUTS_DIRECTORY_NAME.trim_end_matches("/"))
|
||||
| path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches("/"))
|
||||
| path.ends_with(IMPORTS_DIRECTORY_NAME.trim_end_matches("/"))
|
||||
if path.ends_with(INPUTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
| path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
| path.ends_with(IMPORTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// excluded extensions: `.in`, `.bytes`, `lpk`, `lvk`, `.proof`, `.sum`, `.zip`, `.bytes`
|
||||
if let Some(true) = path.extension().map(|ext| {
|
||||
ext.eq(INPUT_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(ZIP_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(PROVING_KEY_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(VERIFICATION_KEY_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(PROOF_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(CHECKSUM_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(ZIP_FILE_EXTENSION.trim_start_matches("."))
|
||||
| ext.eq(CIRCUIT_FILE_EXTENSION.trim_start_matches("."))
|
||||
ext.eq(INPUT_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(ZIP_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(PROVING_KEY_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(VERIFICATION_KEY_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(PROOF_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(CHECKSUM_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(ZIP_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(CIRCUIT_FILE_EXTENSION.trim_start_matches('.'))
|
||||
}) {
|
||||
return false;
|
||||
}
|
||||
@ -177,12 +177,12 @@ fn is_included(path: &Path) -> bool {
|
||||
}
|
||||
|
||||
// Only allow additional files in the `src/` directory
|
||||
if !path.starts_with(SOURCE_DIRECTORY_NAME.trim_end_matches("/")) {
|
||||
if !path.starts_with(SOURCE_DIRECTORY_NAME.trim_end_matches('/')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allow the `.leo` files in the `src/` directory
|
||||
path.extension()
|
||||
.map(|ext| ext.eq(SOURCE_FILE_EXTENSION.trim_start_matches(".")))
|
||||
.map(|ext| ext.eq(SOURCE_FILE_EXTENSION.trim_start_matches('.')))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ impl SourceDirectory {
|
||||
let file_extension = file_path
|
||||
.extension()
|
||||
.ok_or_else(|| SourceDirectoryError::GettingFileExtension(file_path.as_os_str().to_owned()))?;
|
||||
if file_extension != SOURCE_FILE_EXTENSION.trim_start_matches(".") {
|
||||
if file_extension != SOURCE_FILE_EXTENSION.trim_start_matches('.') {
|
||||
return Err(SourceDirectoryError::InvalidFileExtension(
|
||||
file_path.as_os_str().to_owned(),
|
||||
file_extension.to_owned(),
|
||||
|
Loading…
Reference in New Issue
Block a user