Skip to content
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 crates/oxc/examples/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() -> io::Result<()> {
}
Err(errors) => {
for error in errors {
let error = error.with_source_code(source_text.to_string());
let error = error.with_source_code(source_text.clone());
println!("{error:?}");
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_diagnostics/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ mod tests {

for (path, expected) in paths.iter().zip(expected) {
let uri = from_file_path(path).unwrap();
assert_eq!(uri.to_string(), expected);
assert_eq!(uri.clone(), expected);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_estree/src/serialize/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ mod tests {

for (input, output) in cases {
let mut serializer = CompactTSSerializer::default();
input.to_string().serialize(&mut serializer);
input.clone().serialize(&mut serializer);
let s = serializer.into_string();
assert_eq!(&s, output);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_language_server/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ impl LanguageServer for Backend {
if self.capabilities.get().is_some_and(|option| option.dynamic_formatting)
&& let Some(content) = &content
{
self.file_system.write().await.set(uri, content.to_string());
self.file_system.write().await.set(uri, content.clone());
}

if let Some(diagnostics) = worker.lint_file(uri, content, ServerLinterRun::OnType).await {
Expand Down Expand Up @@ -541,7 +541,7 @@ impl LanguageServer for Backend {
let content = params.text_document.text;

if self.capabilities.get().is_some_and(|option| option.dynamic_formatting) {
self.file_system.write().await.set(uri, content.to_string());
self.file_system.write().await.set(uri, content.clone());
}

if let Some(diagnostics) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl ServerFormatter {
#[expect(clippy::unused_self)]
pub fn get_watcher_patterns(&self, options: &LSPFormatOptions) -> Vec<Pattern> {
if let Some(config_path) = options.config_path.as_ref() {
return vec![config_path.to_string()];
return vec![config_path.clone()];
}

FORMAT_CONFIG_FILES.iter().map(|file| (*file).to_string()).collect()
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_language_server/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn get_file_uri(relative_file_path: &str) -> Uri {
fn get_snapshot_from_report(report: &DiagnosticReport) -> String {
let code = match &report.diagnostic.code {
Some(NumberOrString::Number(code)) => code.to_string(),
Some(NumberOrString::String(code)) => code.to_string(),
Some(NumberOrString::String(code)) => code.clone(),
None => "None".to_string(),
};
let code_description_href = match &report.diagnostic.code_description {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Rule for NoRestrictedGlobals {
Value::Array(arr) => arr.iter().fold(FxHashMap::default(), |mut acc, v| match v {
// "no-restricted-globals": ["error", "event"]
Value::String(name) => {
acc.insert(name.to_string(), String::new());
acc.insert(name.clone(), String::new());
acc
}
// "no-restricted-globals": ["error", { "name": "event", "message": "Use local parameter instead." }]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/sort_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl Rule for SortKeys {
.iter()
.map(|(k, _)| {
if self.case_sensitive {
k.to_string()
k.clone()
} else {
k.cow_to_ascii_lowercase().to_string()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ fn test() {
),
];

let _fix = vec![
let _fix = [
(
"const fn = (a?: number = 5) => {};",
"const fn = (a = 5) => {};",
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/unicorn/prefer_math_min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ fn get_expr_value(expr: &Expression) -> Option<String> {
let mut unary_str: String = String::from(lit.operator.as_str());

let Some(unary_lit) = get_expr_value(&lit.argument) else {
return Some(unary_str.to_string());
return Some(unary_str.clone());
};

unary_str.push_str(unary_lit.as_str());

Some(unary_str.to_string())
Some(unary_str.clone())
}
Expression::Identifier(identifier) => Some(identifier.name.to_string()),
_ => None,
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_span/src/compact_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::Span;
/// Maximum length for inline string, which can be created with [`CompactStr::new_const`].
pub const MAX_INLINE_LEN: usize = 16;

/// Lifetimeless version of [`Atom<'_>`] which owns its own string data allocation.
/// Lifetimeless version of [`crate::Atom`] which owns its own string data allocation.
///
/// [`CompactStr`] is immutable. Use [`CompactStr::into_string`] for a mutable
/// [`String`].
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/tests/integrations/es_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ fn target_list_fail() {

for (target, expected) in targets {
let result = TransformOptions::from_target(target);
assert_eq!(result.unwrap_err().to_string(), expected);
assert_eq!(result.unwrap_err().clone(), expected);
}
}
2 changes: 1 addition & 1 deletion napi/playground/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl Oxc {
let semantic = semantic_ret.semantic;
let lint_config = if linter_options.config.is_some() {
let oxlintrc =
Oxlintrc::from_string(&linter_options.config.as_ref().unwrap().to_string())
Oxlintrc::from_string(&linter_options.config.as_ref().unwrap().clone())
.unwrap_or_default();
let config_builder = ConfigStoreBuilder::from_oxlintrc(
false,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.90.0"
channel = "1.91.0"
profile = "default"
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/parse/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ impl<'c> Parser<'c> {
Skeleton::Enum(skeleton) => (skeleton.name, skeleton.file_id, skeleton.item.attrs),
};

let mut meta_type = MetaType::new(meta_id, type_name.to_string(), file_id);
let mut meta_type = MetaType::new(meta_id, type_name.clone(), file_id);

// Process attributes
for attr in &attrs {
Expand Down
2 changes: 1 addition & 1 deletion tasks/coverage/src/tools/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Case for FormatterTypeScriptCase {
fn run(&mut self) {
let units = self.base.units.clone();
for unit in units {
self.base.code = unit.content.to_string();
self.base.code.clone_from(&unit.content);
let result = get_result(&unit.content, unit.source_type);
if result != TestResult::Passed {
self.base.result = result;
Expand Down
2 changes: 1 addition & 1 deletion tasks/coverage/src/tools/semantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl Case for SemanticTypeScriptCase {
fn run(&mut self) {
let units = self.base.units.clone();
for unit in units {
self.base.code = unit.content.to_string();
self.base.code.clone_from(&unit.content);
let result = self.execute(unit.source_type);
if result != TestResult::Passed {
self.base.result = result;
Expand Down
2 changes: 1 addition & 1 deletion tasks/coverage/src/tools/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Case for TransformerTypeScriptCase {
fn run(&mut self) {
let units = self.base.units.clone();
for unit in units {
self.base.code = unit.content.to_string();
self.base.code.clone_from(&unit.content);
let result = self.execute(unit.source_type);
if result != TestResult::Passed {
self.base.result = result;
Expand Down
2 changes: 1 addition & 1 deletion tasks/rulegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ impl<'a> State<'a> {
.map(|arg| {
let case = TestCase::new(self.source_text, arg);
if let Some(group_comment) = self.expression_to_group_comment_map.get(&arg.span()) {
case.with_group_comment(group_comment.to_string())
case.with_group_comment(group_comment.clone())
} else {
case
}
Expand Down
Loading