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

Fix clippy warnings #16

Merged
merged 3 commits into from
Mar 9, 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
3 changes: 1 addition & 2 deletions pulumi_rust/src/pulumi.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cell::RefCell;
use std::io::prelude::*;
use std::ops::DerefMut;
use std::rc::Rc;

Expand Down Expand Up @@ -184,7 +183,7 @@ impl Pulumi {

let component = Component::from_file(&engine, pulumi_wasm_file)?;

Ok(component.serialize()?)
component.serialize()
}

pub async fn start(&self) -> Result<(), Error> {
Expand Down
4 changes: 4 additions & 0 deletions pulumi_rust_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ use std::collections::HashMap;
use std::sync::Mutex;
use lazy_static::lazy_static;

#[allow(clippy::all)]
#[allow(dead_code)]
#[allow(unused_variables)]
#[allow(unused_unsafe)]
pub(crate) mod bindings;

pub mod output;
Expand Down
2 changes: 1 addition & 1 deletion pulumi_rust_wasm/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<T> Output<T> {
pub unsafe fn new_from_handle<F: serde::Serialize>(handle: u32) -> Output<F> {
let output = output_interface::Output::from_handle(handle);
Output {
phantom: PhantomData::<F>::default(),
phantom: PhantomData::<F>,
future: output,
}
}
Expand Down
16 changes: 8 additions & 8 deletions pulumi_wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
use core::fmt::Debug;
use std::collections::{BTreeMap, HashMap};
use std::collections::{BTreeMap};
use std::fmt::Formatter;
use std::ops::Deref;
use futures::SinkExt;
use lazy_static::lazy_static;
use log::{error, info, log};


use log::{error, info};
use prost::Message;
use prost_types::Struct;
use prost_types::value::Kind;
use rmpv::{Utf8String, Value};
use bindings::component::pulumi_wasm::external_world;
use crate::bindings::component::pulumi_wasm::external_world::is_in_preview;
use crate::bindings::component::pulumi_wasm::log::log;


use crate::bindings::exports::component::pulumi_wasm::function_reverse_callback::{
FunctionInvocationRequest, FunctionInvocationResult,
};
use crate::bindings::exports::component::pulumi_wasm::output_interface::Output as WasmOutput;
use crate::bindings::exports::component::pulumi_wasm::output_interface::OutputBorrow as WasmOutputBorrow;

use crate::bindings::exports::component::pulumi_wasm::output_interface::{GuestOutput};
use crate::bindings::exports::component::pulumi_wasm::register_interface::{ObjectField, RegisterResourceRequest};
use crate::bindings::exports::component::pulumi_wasm::register_interface::{RegisterResourceRequest};
use crate::bindings::exports::component::pulumi_wasm::{
function_reverse_callback, output_interface, register_interface,
};
use crate::grpc::register_resource_request;

use crate::output::{access_map, FunctionId, FunctionSource, OutputContent};
bindings::export!(Component with_types_in bindings);

Expand Down
6 changes: 3 additions & 3 deletions pulumi_wasm/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ impl FunctionId {
#[derive(Clone, Debug, Eq, PartialEq)]
pub(crate) struct FunctionSource(String);

impl Into<String> for FunctionSource {
fn into(self) -> String {
self.0
impl From<FunctionSource> for String {
fn from(val: FunctionSource) -> Self {
val.0
}
}

Expand Down
6 changes: 2 additions & 4 deletions pulumi_wasm/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::server::component::pulumi_wasm::log;
use crate::server::exports::component::pulumi_wasm::function_reverse_callback::FunctionInvocationRequest;
use crate::server::PulumiWasm;
use anyhow::{Error, Ok};
use serde::{Deserialize};
use std::collections::HashMap;
use std::string::String;
use wasmtime::component::{Component, Linker, ResourceTable};
Expand All @@ -11,7 +10,6 @@ use wasmtime_wasi::preview2::WasiCtx;
use wasmtime_wasi::preview2::WasiCtxBuilder;
use wasmtime_wasi::preview2::WasiView;
use std::borrow::BorrowMut;
use std::panic;

mod server {
wasmtime::component::bindgen!({
Expand Down Expand Up @@ -143,7 +141,7 @@ fn should_return_value_of_handled_mapped_value() -> Result<(), Error> {
.output()
.call_map(&mut store, output1, function_name)?;

let _ = run_loop(&mut store, &plugin)?;
run_loop(&mut store, &plugin)?;

let output2_value = plugin
.component_pulumi_wasm_output_interface()
Expand Down Expand Up @@ -196,7 +194,7 @@ fn should_panic_when_getting_nonexisting_field_not_during_preview() -> Result<()
.output()
.call_constructor(&mut store, rmp_serde::to_vec(&HashMap::from([("key", "value")])).unwrap().as_slice())?;

let output2 = plugin
let _output2 = plugin
.component_pulumi_wasm_output_interface()
.output()
.call_get_field(&mut store, output1, "nonexisting")?;
Expand Down
8 changes: 3 additions & 5 deletions pulumi_wasm_main/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::fmt::format;
use anyhow::{Context, Error};
use log::{error, info};
use pulumi_rust_wasm::HASHMAP;
Expand Down Expand Up @@ -26,7 +25,7 @@ impl Guest for Component {

let length: Output<i32> = Output::new(&1).map(|i: i32| i * 3);

let v = create_random_string(RandomStringArgs {
let _v = create_random_string(RandomStringArgs {
name: "test1234",
length,
});
Expand Down Expand Up @@ -70,7 +69,7 @@ fn run_all_function(

info!("Functions are not empty");

let mut functions_map = HASHMAP.lock().unwrap();
let functions_map = HASHMAP.lock().unwrap();

let mapped: Result<Vec<_>, _> = functions
.iter()
Expand All @@ -90,7 +89,6 @@ fn run_all_function(
})
},
)
.into_iter()
.collect();

// mapped
Expand All @@ -104,7 +102,7 @@ fn run_all_function(
};

info!("Setting functions");
set_functions(&*mapped);
set_functions(&mapped);
info!("run_all_function completed");

Ok(true)
Expand Down
6 changes: 5 additions & 1 deletion pulumi_wasm_random/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ use log::info;
use crate::bindings::component::pulumi_wasm::register_interface::{ObjectField, register, RegisterResourceRequest};
use crate::bindings::exports::component::pulumi_wasm::pulumi_provider_random_interface::{Guest, RandomStringArgs, RandomStringResult};

#[allow(clippy::all)]
#[allow(dead_code)]
#[allow(unused_variables)]
#[allow(unused_unsafe)]
mod bindings;
bindings::export!(Component with_types_in bindings);

Expand All @@ -17,7 +21,7 @@ impl Guest for Component {
let request = RegisterResourceRequest {
type_: r#type,
name: args.name,
object: vec![ObjectField { name: "length".to_string(), value: &args.length }],
object: vec![ObjectField { name: "length".to_string(), value: args.length }],
};

let o = register(&request);
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async fn main() -> Result<(), Error> {
pulumi.start().await?;
}
Command::Compile { wasm, output } => {
let compiled = Pulumi::compile(&wasm)?;
let compiled = Pulumi::compile(wasm)?;
std::fs::write(output, compiled)?;
}
Command::Plugins { .. } => todo!()
Expand Down
6 changes: 4 additions & 2 deletions wasm_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::Relaxed;

use crate::logger::Logger;
use log::kv::{Source, VisitSource};
use log::Log;

#[allow(clippy::all)]
#[allow(dead_code)]
#[allow(unused_variables)]
#[allow(unused_unsafe)]
mod bindings;
mod logger;

Expand Down
Loading