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

Commit

Permalink
chore: remove alloc references (#1367)
Browse files Browse the repository at this point in the history
Co-authored-by: Rashad Alston <[email protected]>
  • Loading branch information
ra0x3 and Rashad Alston authored Sep 20, 2023
1 parent 14b307c commit 2424dd7
Show file tree
Hide file tree
Showing 32 changed files with 70 additions and 104 deletions.
4 changes: 1 addition & 3 deletions docs/src/designing-a-schema/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Account @entity {
This `Account` object type from the GraphQL schema, might be used in an indexer module like so:

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -44,7 +43,6 @@ enum SignatureLabel {
This `SignatureLabel` object type from the GraphQL schema, might be used in an indexer module like so:

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -108,10 +106,10 @@ type Transaction @entity {
This `Transaction` union type from the GraphQL schema, might be used in an indexer module like so:

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "indexer.manifest.yaml")]

mod indexer_mod {
fn handle_event(event: Event) {
let bytecode_length = 1024;
Expand Down
1 change: 0 additions & 1 deletion docs/src/indexing-fuel-types/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub struct BlockData {
## Usage

```rust,ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down
14 changes: 3 additions & 11 deletions docs/src/indexing-fuel-types/receipts.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ pub struct Burn {
```

```rust, ignore
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
mod indexer_mod {
fn handle_burn_receipt(block_data: BlockData) {
let height = block_data.header.height;
Expand Down Expand Up @@ -68,7 +71,6 @@ pub struct Call {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -103,7 +105,6 @@ pub struct Log {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -143,7 +144,6 @@ pub struct LogData {
> Note: the example below will run both when the type `MyEvent` is logged as well as when `MyEvent` is returned from a function.
```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -173,7 +173,6 @@ pub struct MessageOut {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand All @@ -200,7 +199,6 @@ pub struct Mint {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -234,7 +232,6 @@ pub struct Panic {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -272,7 +269,6 @@ pub struct Return {
You can handle functions that produce a `Return` receipt type by adding a parameter with the type `Return`.

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -340,7 +336,6 @@ pub struct Revert {
| FailedAssert | 4 |

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -373,7 +368,6 @@ pub struct ScriptResult {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -411,7 +405,6 @@ pub struct Transfer {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -449,7 +442,6 @@ pub struct TransferOut {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down
2 changes: 0 additions & 2 deletions docs/src/indexing-fuel-types/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub struct TransactionData {
### Usage

```rust,ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -68,7 +67,6 @@ pub enum TransactionStatus {
### Usage

```rust,ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down
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
2 changes: 2 additions & 0 deletions packages/fuel-indexer-macros/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pub fn handler_block_native(
/// indexer module, not within the scope of the entire lib module.
fn native_prelude() -> proc_macro2::TokenStream {
quote! {
extern crate alloc;

type B256 = [u8; 32];

static mut db: Option<Arc<Mutex<Database>>> = None;
Expand Down
2 changes: 2 additions & 0 deletions packages/fuel-indexer-macros/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ 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
1 change: 0 additions & 1 deletion packages/fuel-indexer-plugin/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate alloc;

use alloc::vec::Vec;
use fuel_indexer_lib::{
graphql::MAX_FOREIGN_KEY_LIST_FIELDS,
Expand Down
2 changes: 0 additions & 2 deletions packages/fuel-indexer-schema/src/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use crate::FtColumn;
use fuel_indexer_lib::join_table_typedefs_name;
use serde::{Deserialize, Serialize};

extern crate alloc;

/// Details for the many-to-many relationship.
///
/// This is essentially the same as `fuel_indexer_lib::graphql::parser::JoinTableRelation`, just
Expand Down
2 changes: 0 additions & 2 deletions packages/fuel-indexer-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// TODO: Deny `clippy::unused_crate_dependencies` when including feature-flagged dependency `itertools`

extern crate alloc;

use fuel_indexer_lib::MAX_ARRAY_LENGTH;
use fuel_indexer_types::{fuel::*, scalar::*, Identity};
use serde::{Deserialize, Serialize};
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
1 change: 0 additions & 1 deletion packages/fuel-indexer-tests/tests/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate alloc;
use fuel_indexer::prelude::fuel::{BlockData, Consensus, Header};
use fuel_indexer::{Executor, IndexerConfig, WasmIndexExecutor};
use fuel_indexer_lib::WasmIndexerError;
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/invalid_abi_type_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::indexer;

#[no_mangle]
Expand Down
Loading

0 comments on commit 2424dd7

Please sign in to comment.