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