proc-macro-api: Fix warnings about clippy str_to_string rule

This commit is contained in:
Tetsuharu Ohzeki 2024-02-10 00:38:39 +09:00
parent 5d1f2835af
commit b89a4038c9
4 changed files with 6 additions and 6 deletions

View File

@ -197,7 +197,7 @@ pub fn expand(
&deserialize_span_data_index_map(&resp.span_data_table),
)
})),
_ => Err(ServerError { message: "unexpected response".to_string(), io: None }),
_ => Err(ServerError { message: "unexpected response".to_owned(), io: None }),
}
}
}

View File

@ -419,7 +419,7 @@ pub(crate) fn intern(&mut self, text: &'a str) -> u32 {
let table = &mut self.text;
*self.string_table.entry(text).or_insert_with(|| {
let idx = table.len();
table.push(text.to_string());
table.push(text.to_owned());
idx as u32
})
}

View File

@ -78,7 +78,7 @@ pub(crate) fn version_check(&mut self) -> Result<u32, ServerError> {
match response {
Response::ApiVersionCheck(version) => Ok(version),
_ => Err(ServerError { message: "unexpected response".to_string(), io: None }),
_ => Err(ServerError { message: "unexpected response".to_owned(), io: None }),
}
}
@ -90,7 +90,7 @@ fn enable_rust_analyzer_spans(&mut self) -> Result<SpanMode, ServerError> {
match response {
Response::SetConfig(crate::msg::ServerConfig { span_mode }) => Ok(span_mode),
_ => Err(ServerError { message: "unexpected response".to_string(), io: None }),
_ => Err(ServerError { message: "unexpected response".to_owned(), io: None }),
}
}
@ -104,7 +104,7 @@ pub(crate) fn find_proc_macros(
match response {
Response::ListMacros(it) => Ok(it),
_ => Err(ServerError { message: "unexpected response".to_string(), io: None }),
_ => Err(ServerError { message: "unexpected response".to_owned(), io: None }),
}
}

View File

@ -38,7 +38,7 @@ macro_rules! err {
let version_part = items.next().ok_or_else(|| err!("no version string"))?;
let mut version_parts = version_part.split('-');
let version = version_parts.next().ok_or_else(|| err!("no version"))?;
let channel = version_parts.next().unwrap_or_default().to_string();
let channel = version_parts.next().unwrap_or_default().to_owned();
let commit = match items.next() {
Some(commit) => {