Skip to content

Commit

Permalink
move definition beside impl
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Nov 20, 2024
1 parent 6d12ba3 commit 522a4f3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions runtime/permissions/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,33 +1114,33 @@ impl ImportDescriptor {
pub struct EnvDescriptorParseError;

#[derive(Clone, Eq, PartialEq, Hash, Debug)]
enum EnvQueryDescriptorInner {
pub enum EnvDescriptor {
Name(EnvVarName),
PrefixPattern(EnvVarName),
}

#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct EnvQueryDescriptor(EnvQueryDescriptorInner);

impl EnvQueryDescriptor {
impl EnvDescriptor {
pub fn new(env: impl AsRef<str>) -> Self {
Self(EnvQueryDescriptorInner::Name(EnvVarName::new(env)))
if let Some(prefix_pattern) = env.as_ref().strip_suffix('*') {
Self::PrefixPattern(EnvVarName::new(prefix_pattern))
} else {
Self::Name(EnvVarName::new(env))
}
}
}

#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum EnvDescriptor {
enum EnvQueryDescriptorInner {
Name(EnvVarName),
PrefixPattern(EnvVarName),
}

impl EnvDescriptor {
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct EnvQueryDescriptor(EnvQueryDescriptorInner);

impl EnvQueryDescriptor {
pub fn new(env: impl AsRef<str>) -> Self {
if let Some(prefix_pattern) = env.as_ref().strip_suffix('*') {
Self::PrefixPattern(EnvVarName::new(prefix_pattern))
} else {
Self::Name(EnvVarName::new(env))
}
Self(EnvQueryDescriptorInner::Name(EnvVarName::new(env)))
}
}

Expand Down

0 comments on commit 522a4f3

Please sign in to comment.