Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

devx: move extern crate alloc to prelude #1351

Closed
wants to merge 2 commits into from
Closed
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
1 change: 0 additions & 1 deletion examples/fuel-explorer/fuel-explorer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

// TODO: We use a lot of manual type conversion below due to https://github.com/FuelLabs/fuel-indexer/issues/286
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
//! ```bash
//! cargo run -p hello-world-data --bin hello-world-data
//! ```
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(
Expand Down
1 change: 0 additions & 1 deletion examples/hello-world/hello-indexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
//! cargo run -p hello-world-data --bin hello-world-data
//! ```

extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "examples/hello-world/hello-indexer/hello_indexer.manifest.yaml")]
Expand Down
1 change: 1 addition & 0 deletions packages/fuel-indexer-macros/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn native_prelude() -> proc_macro2::TokenStream {

static mut db: Option<Arc<Mutex<Database>>> = None;

extern crate alloc;
use fuel_indexer_utils::plugin::types::*;
use fuel_indexer_utils::plugin::native::*;
use fuel_indexer_utils::plugin::{serde_json, serialize, deserialize, bincode};
Expand Down
1 change: 1 addition & 0 deletions packages/fuel-indexer-macros/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub fn handler_block_wasm(
/// indexer module, not within the scope of the entire lib module.
fn wasm_prelude() -> proc_macro2::TokenStream {
quote! {
extern crate alloc;
use alloc::{format, vec, vec::Vec};
use std::str::FromStr;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate alloc;

use fuel_indexer_utils::prelude::*;

#[indexer(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/indexers/simple-wasm/simple_wasm.yaml")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml")]
#[indexer(
manifest = "packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml"
)]
mod indexer {
fn function_one(event: BlockHeight) {
let BlockHeight { id, account } = event;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
Expand All @@ -13,7 +12,10 @@ fn ff_put_many_to_many_record(_inp: ()) {}
#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")]
mod indexer {
fn function_one() {
let t1 = Thing1 { id: uid([1]), account: Address::default() };
let t1 = Thing1 {
id: uid([1]),
account: Address::default(),
};
t1.save();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::indexer;

#[no_mangle]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
fn ff_log_data(_inp: ()) {}

#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/invalid_schema_simple_wasm.yaml")]
#[indexer(
manifest = "packages/fuel-indexer-tests/trybuild/invalid_schema_simple_wasm.yaml"
)]
mod indexer {
fn function_one(event: SomeEvent) {
let SomeEvent { id, account } = event;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")]
mod indexer {

mod some_disallowed_module {
mod some_disallowed_module {}

}

fn function_one(event: SomeEvent) {
let SomeEvent { id, account } = event;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
Expand Down
6 changes: 2 additions & 4 deletions plugins/forc-index/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ pub fn default_indexer_lib(
let manifest_path = manifest_path.display();

format!(
r#"extern crate alloc;
use fuel_indexer_utils::prelude::*;
r#"use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "{manifest_path}")]
pub mod {indexer_name}_index_mod {{
Expand Down Expand Up @@ -186,8 +185,7 @@ pub fn default_indexer_binary(
let manifest_path = manifest_path.display();

format!(
r#"extern crate alloc;
use fuel_indexer_utils::prelude::*;
r#"use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "{manifest_path}")]
pub mod {indexer_name}_index_mod {{
Expand Down