Skip to content

Commit c573ee6

Browse files
committed
better docs
1 parent c41bb8e commit c573ee6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

crates/compilers/src/compilers/restrictions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use std::{
55

66
use semver::VersionReq;
77

8+
/// Abstraction over set of restrictions for given [`crate::Compiler::Settings`].
89
pub trait CompilerSettingsRestrictions: Copy + Debug + Sync + Send + Clone + Default {
10+
/// Combines this restriction with another one. Returns `None` if restrictions are incompatible.
911
fn merge(self, other: Self) -> Option<Self>;
1012
}
1113

crates/compilers/src/compilers/solc/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,15 @@ impl DerefMut for SolcSettings {
190190
}
191191
}
192192

193+
/// Abstraction over min/max restrictions on some value.
193194
#[derive(Debug, Clone, Copy, Eq, Default, PartialEq)]
194195
pub struct Restriction<V> {
195196
pub min: Option<V>,
196197
pub max: Option<V>,
197198
}
198199

199-
impl<V: PartialEq + Ord + Copy> Restriction<V> {
200-
/// Returns true if the given version satisfies the restrictions
200+
impl<V: Ord + Copy> Restriction<V> {
201+
/// Returns true if the given value satisfies the restrictions
201202
///
202203
/// If given None, only returns true if no restrictions are set
203204
pub fn satisfies(&self, value: Option<V>) -> bool {
@@ -237,6 +238,7 @@ impl<V: PartialEq + Ord + Copy> Restriction<V> {
237238
}
238239
}
239240

241+
/// Restrictions on settings for the solc compiler.
240242
#[derive(Debug, Clone, Copy, Default)]
241243
pub struct SolcRestrictions {
242244
pub evm_version: Restriction<EvmVersion>,

crates/compilers/src/resolver/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
695695
Err(msg)
696696
}
697697

698+
/// Filters profiles incompatible with the given node and its imports.
698699
fn retain_compatible_profiles<C: Compiler, T: ArtifactOutput>(
699700
&self,
700701
idx: usize,
@@ -730,7 +731,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
730731
if all_profiles.is_empty() {
731732
let f = utils::source_name(&failed_node.path, &self.root).display();
732733
return Err(
733-
format!("Missing profile satisfying settings restrictions for {f}").to_string(),
734+
format!("Missing profile satisfying settings restrictions for {f}").to_string()
734735
);
735736
}
736737

0 commit comments

Comments
 (0)