mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
fix: Fix broken build (#453)
The clone optimization PR didn't have the latest changes for "azure_policy". Integration resulted in compile errors. Also fix errors due to updated clippy lints. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
dbba57f499
commit
de6aa2bcd1
@@ -267,7 +267,7 @@ struct GoTimeFormatItems<'a> {
|
||||
}
|
||||
|
||||
impl GoTimeFormatItems<'_> {
|
||||
fn parse(reminder: &str) -> GoTimeFormatItems {
|
||||
fn parse(reminder: &str) -> GoTimeFormatItems<'_> {
|
||||
GoTimeFormatItems {
|
||||
reminder,
|
||||
queue: &[],
|
||||
@@ -275,7 +275,7 @@ impl GoTimeFormatItems<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
fn format(reminder: &str) -> GoTimeFormatItems {
|
||||
fn format(reminder: &str) -> GoTimeFormatItems<'_> {
|
||||
GoTimeFormatItems {
|
||||
reminder,
|
||||
queue: &[],
|
||||
|
||||
@@ -108,7 +108,7 @@ fn parse(span: &Span, params: &[Ref<Expr>], args: &[Value], _strict: bool) -> Re
|
||||
n.mul_assign(&Number::two_pow(e)?)?;
|
||||
Ok(Value::from(n))
|
||||
} else {
|
||||
return Ok(Value::Undefined);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,14 @@ pub struct Engine {
|
||||
rego_v1: bool,
|
||||
}
|
||||
|
||||
#[cfg(feature = "azure_policy")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct PolicyPackageNameDefinition {
|
||||
pub source_file: String,
|
||||
pub package_name: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "azure_policy")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct PolicyParameter {
|
||||
pub name: String,
|
||||
@@ -36,11 +38,13 @@ pub struct PolicyParameter {
|
||||
pub required: bool,
|
||||
}
|
||||
|
||||
#[cfg(feature = "azure_policy")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct PolicyModifier {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "azure_policy")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct PolicyParameters {
|
||||
pub source_file: String,
|
||||
@@ -954,7 +958,7 @@ impl Engine {
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "azure_policy")))]
|
||||
pub fn get_policy_package_names(&self) -> Result<Vec<PolicyPackageNameDefinition>> {
|
||||
let mut package_names = vec![];
|
||||
for m in &self.modules {
|
||||
for m in self.modules.iter() {
|
||||
let package_name = Interpreter::get_path_string(&m.package.refr, None)?;
|
||||
package_names.push(PolicyPackageNameDefinition {
|
||||
source_file: m.package.span.source.file().to_string(),
|
||||
@@ -987,7 +991,7 @@ impl Engine {
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "azure_policy")))]
|
||||
pub fn get_policy_parameters(&self) -> Result<Vec<PolicyParameters>> {
|
||||
let mut policy_parameter_definitions = vec![];
|
||||
for m in &self.modules {
|
||||
for m in self.modules.iter() {
|
||||
let mut parameters = vec![];
|
||||
let mut modifiers = vec![];
|
||||
|
||||
|
||||
@@ -3696,9 +3696,7 @@ impl Interpreter {
|
||||
MapEntry::Occupied(o) => {
|
||||
if idx + 1 == comps.len() {
|
||||
for (_, i) in o.get() {
|
||||
if index.is_some() && i.is_some() {
|
||||
let old = i.as_ref().unwrap();
|
||||
let new = index.as_ref().unwrap();
|
||||
if let (Some(old), Some(new)) = (i, &index) {
|
||||
if old == new {
|
||||
bail!(refr.span().error("multiple default rules for the variable with the same index"));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ impl cmp::Eq for SourceStr {}
|
||||
|
||||
impl cmp::PartialOrd for SourceStr {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||
Some(self.text().cmp(other.text()))
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user