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

Plans to warn about unused code elements? #3395

Closed
donaldcallen opened this issue Oct 7, 2019 · 1 comment
Closed

Plans to warn about unused code elements? #3395

donaldcallen opened this issue Oct 7, 2019 · 1 comment

Comments

@donaldcallen
Copy link

donaldcallen commented Oct 7, 2019

Are there plans to provide warnings about unused elements, whether they be imports, structs, struct fields, enums, enums fields, consts, etc.?

I have found this to be very helpful in my Rust work in weeding out unused clutter in my code.

As a test, I just tried compiling this very incomplete code fragment, with a lot of unused stuff. it compiled without error or warning:

const std = @import("std");
const allocator = std.heap.c_allocator;
const constants = @import("open_positions_constants.zig");
const debug = std.debug;
const fs = std.fs;
const io = std.io;
const lib = @import("../library/lib.zig");
const math = std.math;
const mem = std.mem;
const os = std.os;
const process = std.process;

const OpenPosition = struct {
    symbol: []const u8,
    name: []const u8,
    cusip: []const u8,
    commodity_guid: []const u8,
    quantity: f64,
    current_value: ?f64,
    capital_gain: ?f64,
    total_gain: ?f64,
    annualized_return: ?f64,
    total_annualized_return: ?f64,
    most_recent_quote_timestamp: ?f64,
};

const InvestmentReportType = enum {
    Value,
    CapitalGain,
    TotalCapitalGain,
    AnnualizedReturn,
    TotalAnnualizedReturn,
    MostRecentQuote,
};

pub fn main() void {
    const END_DATE = 1;
}
@daurnimator daurnimator added the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Oct 8, 2019
@emekoi
Copy link
Contributor

emekoi commented Oct 8, 2019

duplicate of #335.

@andrewrk andrewrk closed this as completed Oct 9, 2019
@andrewrk andrewrk removed the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants