> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove Unnecessary Cast

#### Sourcery refactoring id: `remove-unnecessary-cast`

#### Description

Remove unnecessary casts to int, str, float and bool

#### Before

```python
num_hats = 1
update_hat_count(int(num_hats))
```

#### After

```python
num_hats = 1
update_hat_count(num_hats)
```

#### Explanation

If a variable is already an `int`, `str`, `float` or `bool` it is unnecessary to
wrap it in the associated call later on in the code. Removing these unnecessary
casts is a small improvement in readability, and can eliminate the mental
overhead of trying to figure out why or whether the cast is required.
