Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clippy #204

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/artifacts/solc/src/output_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use std::{collections::BTreeMap, fmt, str::FromStr};
/// Represents the desired outputs based on a File `(file -> (contract -> [outputs]))`
pub type FileOutputSelection = BTreeMap<String, Vec<String>>;

/// Represents the selected output of files and contracts
/// Represents the selected output of files and contracts.
///
/// The first level key is the file name and the second level key is the
/// contract name. An empty contract name is used for outputs that are
/// not tied to a contract but to the whole source file like the AST.
Expand Down
13 changes: 8 additions & 5 deletions crates/compilers/src/compilers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ pub trait CompilerInput: Serialize + Send + Sync + Sized + Debug {
}

/// Parser of the source files which is used to identify imports and version requirements of the
/// given source. Used by path resolver to resolve imports or determine compiler versions needed to
/// compiler given sources.
/// given source.
///
/// Used by path resolver to resolve imports or determine compiler versions needed to compiler given
/// sources.
pub trait ParsedSource: Debug + Sized + Send + Clone {
type Language: Language;

Expand Down Expand Up @@ -247,9 +249,10 @@ pub trait Language:
const FILE_EXTENSIONS: &'static [&'static str];
}

/// The main compiler abstraction trait. Currently mostly represents a wrapper around compiler
/// binary aware of the version and able to compile given input into [CompilerOutput] including
/// artifacts and errors.'
/// The main compiler abstraction trait.
///
/// Currently mostly represents a wrapper around compiler binary aware of the version and able to
/// compile given input into [`CompilerOutput`] including artifacts and errors.
#[auto_impl::auto_impl(&, Box, Arc)]
pub trait Compiler: Send + Sync + Clone {
/// Input type for the compiler. Contains settings and sources to be compiled.
Expand Down
6 changes: 4 additions & 2 deletions crates/compilers/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ impl<D> GraphEdges<D> {
}
}

/// Represents a fully-resolved solidity dependency graph. Each node in the graph
/// is a file and edges represent dependencies between them.
/// Represents a fully-resolved solidity dependency graph.
///
/// Each node in the graph is a file and edges represent dependencies between them.
///
/// See also <https://docs.soliditylang.org/en/latest/layout-of-source-files.html?highlight=import#importing-other-source-files>
#[derive(Debug)]
pub struct Graph<D = SolData> {
Expand Down
23 changes: 12 additions & 11 deletions crates/core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,12 @@ pub fn resolve_absolute_library(
None
}

/// Reads the list of Solc versions that have been installed in the machine. The version list is
/// sorted in ascending order.
/// Checks for installed solc versions under the given path as
/// `<root>/<major.minor.path>`, (e.g.: `~/.svm/0.8.10`)
/// and returns them sorted in ascending order
/// Reads the list of Solc versions that have been installed in the machine.
///
/// The version list is sorted in ascending order.
///
/// Checks for installed solc versions under the given path as `<root>/<major.minor.path>`,
/// (e.g.: `~/.svm/0.8.10`) and returns them sorted in ascending order.
pub fn installed_versions(root: &Path) -> Result<Vec<Version>, SolcError> {
let mut versions: Vec<_> = walkdir::WalkDir::new(root)
.max_depth(1)
Expand Down Expand Up @@ -619,13 +620,13 @@ pub fn create_parent_dir_all(file: &Path) -> Result<(), SolcError> {
Ok(())
}

/// Given the regex and the target string, find all occurrences
/// of named groups within the string. This method returns
/// the tuple of matches `(a, b)` where `a` is the match for the
/// entire regex and `b` is the match for the first named group.
/// Given the regex and the target string, find all occurrences of named groups within the string.
///
/// This method returns the tuple of matches `(a, b)` where `a` is the match for the entire regex
/// and `b` is the match for the first named group.
///
/// NOTE: This method will return the match for the first named
/// group, so the order of passed named groups matters.
/// NOTE: This method will return the match for the first named group, so the order of passed named
/// groups matters.
pub fn capture_outer_and_inner<'a>(
content: &'a str,
regex: &regex::Regex,
Expand Down