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

Implement #54 + New Clippy Lint #58

Merged
merged 7 commits into from
Mar 21, 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
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msrv = "1.70.0" # MSRV
msrv = "1.76.0" # MSRV
warn-on-all-wildcard-imports = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ too_many_arguments = "allow"
type_complexity = "allow"
wrong_self_convention = "allow"
rc_buffer = "warn"
# str_to_string = "warn"
str_to_string = "warn"
12 changes: 6 additions & 6 deletions crates/weaver_forge/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,32 +227,32 @@ pub struct TemplateSyntax {

/// Default block start delimiter.
fn default_block_start() -> String {
"{%".to_string()
"{%".to_owned()
}

/// Default block end delimiter.
fn default_block_end() -> String {
"%}".to_string()
"%}".to_owned()
}

/// Default variable start delimiter.
fn default_variable_start() -> String {
"{{".to_string()
"{{".to_owned()
}

/// Default variable end delimiter.
fn default_variable_end() -> String {
"}}".to_string()
"}}".to_owned()
}

/// Default comment start delimiter.
fn default_comment_start() -> String {
"{#".to_string()
"{#".to_owned()
}

/// Default comment end delimiter.
fn default_comment_end() -> String {
"#}".to_string()
"#}".to_owned()
}

impl From<TemplateSyntax> for minijinja::Syntax {
Expand Down
8 changes: 4 additions & 4 deletions crates/weaver_forge/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ impl Filter {
return Err(Error::CompoundError(
errs.into_iter()
.map(|e| Error::FilterError {
filter: filter_expr.to_string(),
filter: filter_expr.to_owned(),
error: e.to_string(),
})
.collect(),
));
}

let parsed_expr = parsed_expr.ok_or_else(|| Error::FilterError {
filter: filter_expr.to_string(),
error: "No parsed expression".to_string(),
filter: filter_expr.to_owned(),
error: "No parsed expression".to_owned(),
})?;

Ok(Self {
filter_expr: filter_expr.to_string(),
filter_expr: filter_expr.to_owned(),
filter: ctx.compile(parsed_expr),
})
}
Expand Down
8 changes: 4 additions & 4 deletions crates/weaver_forge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Object for TemplateObject {
) -> Result<Value, minijinja::Error> {
if name == "set_file_name" {
let (file_name,): (&str,) = from_args(args)?;
*self.file_name.lock().expect("Lock poisoned") = file_name.to_string();
file_name.clone_into(&mut self.file_name.lock().expect("Lock poisoned"));
Ok(Value::from(""))
} else {
Err(minijinja::Error::new(
Expand Down Expand Up @@ -146,7 +146,7 @@ impl TemplateEngine {
if !target_path.exists() {
return Err(TargetNotSupported {
root_path: config.root_dir.to_string_lossy().to_string(),
target: target.to_string(),
target: target.to_owned(),
});
}

Expand Down Expand Up @@ -292,13 +292,13 @@ impl TemplateEngine {
) -> Result<(), Error> {
let template_object = TemplateObject {
file_name: Arc::new(Mutex::new(
template_path.to_str().unwrap_or_default().to_string(),
template_path.to_str().unwrap_or_default().to_owned(),
)),
};
let mut engine = self.template_engine()?;
let template_file = template_path.to_str().ok_or(InvalidTemplateFile {
template: template_path.to_path_buf(),
error: "".to_string(),
error: "".to_owned(),
})?;

engine.add_global("template", Value::from_object(template_object.clone()));
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_resolved_schema/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Catalog {
RequirementLevel::Recommended { .. } => "recommended",
RequirementLevel::ConditionallyRequired { .. } => "conditionally_required",
};
(requirement_level.to_string(), 1)
(requirement_level.to_owned(), 1)
})
.fold(BTreeMap::new(), |mut acc, (k, v)| {
*acc.entry(k).or_insert(0) += v;
Expand Down
4 changes: 2 additions & 2 deletions crates/weaver_resolver/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl AttributeCatalog {
root_attr_id,
AttributeWithGroupId {
attribute: attr.clone(),
group_id: group_id.to_string(),
group_id: group_id.to_owned(),
},
);
Some(self.attribute_ref(attr))
Expand Down Expand Up @@ -407,7 +407,7 @@ pub fn resolve_attribute(
.attribute(r#ref)
.ok_or(Error::FailToResolveAttributes {
ids: vec![r#ref.clone()],
error: "Attribute ref not found in the resolved registry".to_string(),
error: "Attribute ref not found in the resolved registry".to_owned(),
})?;
resolve_attribute(registry, sem_conv_attr)
}
Expand Down
6 changes: 3 additions & 3 deletions crates/weaver_resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ impl SchemaResolver {
_ = registries.insert(registry.id().into(), resolved_registry);

let resolved_schema = ResolvedTelemetrySchema {
file_format: "1.0.0".to_string(),
schema_url: "".to_string(),
file_format: "1.0.0".to_owned(),
schema_url: "".to_owned(),
registries,
catalog,
resource: None,
Expand Down Expand Up @@ -661,7 +661,7 @@ impl SchemaResolver {
// of the semantic convention file.
let prefix = git_repo
.to_str()
.map(|s| s.to_string())
.map(|s| s.to_owned())
.unwrap_or_default();
let path = format!(
"{}/{}",
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_resolver/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub fn resolve_metrics(
metric_group_ref: metrics.name.clone(),
metric_ref: referenced_metric.name.clone(),
error: "Some required attributes are missing in this metric"
.to_string(),
.to_owned(),
});
}

Expand Down
Loading
Loading