Add clippy suggestions (#6203)
* add clippy suggestions * revert &/ref change * Update cranelift/isle/isle/src/parser.rs Co-authored-by: Jamey Sharp <jamey@minilop.net> --------- Co-authored-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
2
crates/cache/build.rs
vendored
2
crates/cache/build.rs
vendored
@@ -2,7 +2,7 @@ use std::process::Command;
|
||||
use std::str;
|
||||
|
||||
fn main() {
|
||||
let git_rev = match Command::new("git").args(&["rev-parse", "HEAD"]).output() {
|
||||
let git_rev = match Command::new("git").args(["rev-parse", "HEAD"]).output() {
|
||||
Ok(output) => str::from_utf8(&output.stdout).unwrap().trim().to_string(),
|
||||
Err(_) => env!("CARGO_PKG_VERSION").to_string(),
|
||||
};
|
||||
|
||||
@@ -117,7 +117,7 @@ fn parse_source(source: &Option<Source>) -> anyhow::Result<(Resolve, PackageId,
|
||||
let root = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
let mut parse = |path: &Path| -> anyhow::Result<_> {
|
||||
if path.is_dir() {
|
||||
let (pkg, sources) = resolve.push_dir(&path)?;
|
||||
let (pkg, sources) = resolve.push_dir(path)?;
|
||||
files = sources;
|
||||
Ok(pkg)
|
||||
} else {
|
||||
@@ -128,10 +128,10 @@ fn parse_source(source: &Option<Source>) -> anyhow::Result<(Resolve, PackageId,
|
||||
};
|
||||
let pkg = match source {
|
||||
Some(Source::Inline(s)) => resolve.push(
|
||||
UnresolvedPackage::parse("macro-input".as_ref(), &s)?,
|
||||
UnresolvedPackage::parse("macro-input".as_ref(), s)?,
|
||||
&Default::default(),
|
||||
)?,
|
||||
Some(Source::Path(s)) => parse(&root.join(&s))?,
|
||||
Some(Source::Path(s)) => parse(&root.join(s))?,
|
||||
None => parse(&root.join("wit"))?,
|
||||
};
|
||||
|
||||
|
||||
@@ -151,9 +151,9 @@ impl Wasmtime {
|
||||
let mut gen = InterfaceGenerator::new(self, resolve);
|
||||
let import = match item {
|
||||
WorldItem::Function(func) => {
|
||||
gen.generate_function_trait_sig(TypeOwner::None, &func);
|
||||
gen.generate_function_trait_sig(TypeOwner::None, func);
|
||||
let sig = mem::take(&mut gen.src).into();
|
||||
gen.generate_add_function_to_linker(TypeOwner::None, &func, "linker");
|
||||
gen.generate_add_function_to_linker(TypeOwner::None, func, "linker");
|
||||
let add_to_linker = gen.src.into();
|
||||
Import::Function { sig, add_to_linker }
|
||||
}
|
||||
@@ -203,7 +203,7 @@ impl Wasmtime {
|
||||
let (_name, getter) = gen.extract_typed_function(func);
|
||||
assert!(gen.src.is_empty());
|
||||
self.exports.funcs.push(body);
|
||||
(format!("wasmtime::component::Func"), getter)
|
||||
("wasmtime::component::Func".to_string(), getter)
|
||||
}
|
||||
WorldItem::Type(_) => unreachable!(),
|
||||
WorldItem::Interface(id) => {
|
||||
@@ -1051,9 +1051,9 @@ impl<'a> InterfaceGenerator<'a> {
|
||||
uwriteln!(self.src, "}}");
|
||||
|
||||
let where_clause = if self.gen.opts.async_ {
|
||||
format!("T: Send, U: Host + Send")
|
||||
"T: Send, U: Host + Send".to_string()
|
||||
} else {
|
||||
format!("U: Host")
|
||||
"U: Host".to_string()
|
||||
};
|
||||
uwriteln!(
|
||||
self.src,
|
||||
@@ -1259,7 +1259,7 @@ impl<'a> InterfaceGenerator<'a> {
|
||||
|
||||
let ret = (snake, mem::take(&mut self.src).to_string());
|
||||
self.src = prev;
|
||||
return ret;
|
||||
ret
|
||||
}
|
||||
|
||||
fn define_rust_guest_export(&mut self, ns: Option<&str>, func: &Function) {
|
||||
|
||||
@@ -235,7 +235,7 @@ pub trait RustGenerator<'a> {
|
||||
if self.uses_two_names(&info) {
|
||||
result.push((self.param_name(ty), TypeMode::AllBorrowed("'a")));
|
||||
}
|
||||
return result;
|
||||
result
|
||||
}
|
||||
|
||||
/// Writes the camel-cased 'name' of the passed type to `out`, as used to name union variants.
|
||||
|
||||
@@ -95,7 +95,7 @@ impl Types {
|
||||
_ => continue,
|
||||
};
|
||||
if let Some(Type::Id(id)) = err {
|
||||
self.type_info.get_mut(&id).unwrap().error = true;
|
||||
self.type_info.get_mut(id).unwrap().error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user